Use typed runtime item catalog

This commit is contained in:
Meta Vens 2026-06-13 14:36:54 +01:00
commit 949907de65
11 changed files with 415 additions and 245 deletions

View file

@ -36,8 +36,6 @@ public class ActionGameManager : MonoBehaviour
get => _gameDataDirectory ??= new DirectoryInfo(Application.dataPath).Parent.CreateSubdirectory("GameData");
}
private static string LegacyAetherDatabasePath => LegacyItemCatalogBoundary.GetLegacyItemCatalogPath(GameDataDirectory);
private static ILegacyItemCatalogReader LegacyCatalog => LegacyItemCatalogBoundary.GetCatalog(GameDataDirectory);
private static PlayerSettings _playerSettings;
public static PlayerSettings PlayerSettings
@ -245,9 +243,15 @@ public class ActionGameManager : MonoBehaviour
Debug.Log($"Aetheria typed runtime catalog: {RuntimeCatalog.Items.Count} items, {RuntimeCatalog.Corporations.Count} corporations, {RuntimeCatalog.NameFiles.Count} name files");
}
Debug.Log($"Aetheria legacy item catalog: {LegacyAetherDatabasePath}");
if (RuntimeCatalog == null)
{
throw new InvalidOperationException("Aetheria typed runtime catalog is required before gameplay boot.");
}
var runtimeItemCatalog = new AetheriaRuntimeItemCatalog(RuntimeCatalog);
DatabaseLinkBase.BindRuntimeItemCatalog(runtimeItemCatalog);
ItemManager = new ItemManager(
LegacyCatalog,
runtimeItemCatalog,
Settings.GameplaySettings,
Debug.Log);
ZoneRenderer.ItemManager = ItemManager;

View file

@ -1,22 +0,0 @@
using System.IO;
public static class LegacyItemCatalogBoundary
{
private static LegacyItemCatalogCache _catalogCache;
public static string GetLegacyItemCatalogPath(DirectoryInfo gameDataDirectory)
{
return Path.Combine(gameDataDirectory.FullName, "AetherDB.msgpack");
}
public static ILegacyItemCatalogReader GetCatalog(DirectoryInfo gameDataDirectory)
{
if (_catalogCache != null) return _catalogCache;
_catalogCache = new LegacyItemCatalogCache();
_catalogCache.AddBackingStore(new SingleFileMessagePackBackingStore(GetLegacyItemCatalogPath(gameDataDirectory)));
_catalogCache.PullAllBackingStores();
DatabaseLinkBase.BindLegacyItemCatalog(_catalogCache);
return _catalogCache;
}
}

View file

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f32bcbdbd7db4a3595f11f4540b90a3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: