-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Ported "Assetdex and Browser" PR
- Loading branch information
Showing
51 changed files
with
312,030 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Org.BouncyCastle.Pqc.Crypto.Lms; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization.Metadata; | ||
using System.Threading.Tasks; | ||
using static SoulsFormats.HKXPWV; | ||
|
||
namespace StudioCore.Assetdex | ||
{ | ||
public class AssetContainer | ||
{ | ||
private AssetResource chrEntries = new AssetResource(); | ||
private AssetResource objEntries = new AssetResource(); | ||
private AssetResource partEntries = new AssetResource(); | ||
private AssetResource mapPieceEntries = new AssetResource(); | ||
|
||
public AssetContainer(string gametype) | ||
{ | ||
chrEntries = LoadJSON(gametype, "Chr"); | ||
objEntries = LoadJSON(gametype, "Obj"); | ||
partEntries = LoadJSON(gametype, "Part"); | ||
mapPieceEntries = LoadJSON(gametype, "MapPiece"); | ||
} | ||
|
||
private AssetResource LoadJSON(string gametype, string type) | ||
{ | ||
AssetResource resource = new AssetResource(); | ||
|
||
string json_filepath = AppContext.BaseDirectory + $"\\Assets\\Assetdex\\{gametype}\\{type}.json"; | ||
|
||
if (File.Exists(json_filepath)) | ||
{ | ||
var options = new JsonSerializerOptions | ||
{ | ||
ReadCommentHandling = JsonCommentHandling.Skip, | ||
TypeInfoResolver = new DefaultJsonTypeInfoResolver() | ||
}; | ||
resource = JsonSerializer.Deserialize<AssetResource>(File.OpenRead(json_filepath), options); | ||
} | ||
|
||
return resource; | ||
} | ||
|
||
public List<AssetReference> GetChrEntries() | ||
{ | ||
return chrEntries.list; | ||
} | ||
public List<AssetReference> GetObjEntries() | ||
{ | ||
return objEntries.list; | ||
} | ||
public List<AssetReference> GetPartEntries() | ||
{ | ||
return partEntries.list; | ||
} | ||
public List<AssetReference> GetMapPieceEntries() | ||
{ | ||
return mapPieceEntries.list; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace StudioCore.Assetdex | ||
{ | ||
/// <summary> | ||
/// Class <c>AssetReference</c> is an entry contained within a <c>AssetReference</c> list within a <c>GameReference</c>. | ||
/// </summary> | ||
public class AssetReference | ||
{ | ||
public string id { get; set; } | ||
public string name { get; set; } | ||
public List<string> tags { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
|
||
namespace StudioCore.Assetdex | ||
{ | ||
/// <summary> | ||
/// Class <c>AssetdexResource</c> is the root object filled by the JSON deserialization. | ||
/// </summary> | ||
public class AssetResource | ||
{ | ||
public List<AssetReference> list { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
|
||
namespace StudioCore.Assetdex | ||
{ | ||
/// <summary> | ||
/// Class <c>AssetdexCore</c> contains the <c>AssetReference</c> dictionaries that host the documentation for each asset. | ||
/// </summary> | ||
public class AssetdexCore | ||
{ | ||
private Dictionary<GameType, AssetContainer> assetContainers = new Dictionary<GameType, AssetContainer>(); | ||
|
||
public AssetdexCore() | ||
{ | ||
assetContainers.Add(GameType.Undefined, BuildAssetContainer("DS1")); // Fallback for Undefined project | ||
assetContainers.Add(GameType.DemonsSouls, BuildAssetContainer("DES")); | ||
assetContainers.Add(GameType.DarkSoulsPTDE, BuildAssetContainer("DS1")); | ||
assetContainers.Add(GameType.DarkSoulsRemastered, BuildAssetContainer("DS1R")); | ||
assetContainers.Add(GameType.DarkSoulsIISOTFS, BuildAssetContainer("DS2S")); | ||
assetContainers.Add(GameType.Bloodborne, BuildAssetContainer("BB")); | ||
assetContainers.Add(GameType.DarkSoulsIII, BuildAssetContainer("DS3")); | ||
assetContainers.Add(GameType.Sekiro, BuildAssetContainer("SDT")); | ||
assetContainers.Add(GameType.EldenRing, BuildAssetContainer("ER")); | ||
assetContainers.Add(GameType.ArmoredCoreVI, BuildAssetContainer("AC6")); | ||
} | ||
|
||
private AssetContainer BuildAssetContainer(string gametype) | ||
{ | ||
AssetContainer container = new AssetContainer(gametype); | ||
|
||
return container; | ||
} | ||
|
||
public Dictionary<string, AssetReference> GetChrEntriesForGametype(GameType gametype) | ||
{ | ||
Dictionary<string, AssetReference> dict = new Dictionary<string, AssetReference>(); | ||
|
||
foreach(AssetReference entry in assetContainers[gametype].GetChrEntries()) | ||
{ | ||
if(!dict.ContainsKey(entry.id.ToLower())) | ||
dict.Add(entry.id.ToLower(), entry); | ||
} | ||
|
||
return dict; | ||
} | ||
|
||
public Dictionary<string, AssetReference> GetObjEntriesForGametype(GameType gametype) | ||
{ | ||
Dictionary<string, AssetReference> dict = new Dictionary<string, AssetReference>(); | ||
|
||
foreach (AssetReference entry in assetContainers[gametype].GetObjEntries()) | ||
{ | ||
if (!dict.ContainsKey(entry.id.ToLower())) | ||
dict.Add(entry.id.ToLower(), entry); | ||
} | ||
|
||
return dict; | ||
} | ||
|
||
public Dictionary<string, AssetReference> GetPartEntriesForGametype(GameType gametype) | ||
{ | ||
Dictionary<string, AssetReference> dict = new Dictionary<string, AssetReference>(); | ||
|
||
foreach (AssetReference entry in assetContainers[gametype].GetPartEntries()) | ||
{ | ||
if (!dict.ContainsKey(entry.id.ToLower())) | ||
dict.Add(entry.id.ToLower(), entry); | ||
} | ||
|
||
return dict; | ||
} | ||
|
||
public Dictionary<string, AssetReference> GetMapPieceEntriesForGametype(GameType gametype) | ||
{ | ||
Dictionary<string, AssetReference> dict = new Dictionary<string, AssetReference>(); | ||
|
||
foreach (AssetReference entry in assetContainers[gametype].GetMapPieceEntries()) | ||
{ | ||
if (!dict.ContainsKey(entry.id.ToLower())) | ||
dict.Add(entry.id.ToLower(), entry); | ||
} | ||
|
||
return dict; | ||
} | ||
} | ||
} |
Oops, something went wrong.