Rename legacy item catalog bridge
This commit is contained in:
parent
9655d5ad7b
commit
0133531d40
7 changed files with 39 additions and 39 deletions
|
|
@ -36,8 +36,8 @@ public class ActionGameManager : MonoBehaviour
|
|||
get => _gameDataDirectory ??= new DirectoryInfo(Application.dataPath).Parent.CreateSubdirectory("GameData");
|
||||
}
|
||||
|
||||
private static string LegacyAetherDatabasePath => LegacyCatalogBoundary.GetLegacyCatalogPath(GameDataDirectory);
|
||||
private static ILegacyCatalogReader LegacyCatalog => LegacyCatalogBoundary.GetCatalog(GameDataDirectory);
|
||||
private static string LegacyAetherDatabasePath => LegacyItemCatalogBoundary.GetLegacyItemCatalogPath(GameDataDirectory);
|
||||
private static ILegacyItemCatalogReader LegacyCatalog => LegacyItemCatalogBoundary.GetCatalog(GameDataDirectory);
|
||||
|
||||
private static PlayerSettings _playerSettings;
|
||||
public static PlayerSettings PlayerSettings
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
using System.IO;
|
||||
|
||||
public static class LegacyCatalogBoundary
|
||||
public static class LegacyItemCatalogBoundary
|
||||
{
|
||||
private static LegacyCatalogCache _catalogCache;
|
||||
private static LegacyItemCatalogCache _catalogCache;
|
||||
|
||||
public static string GetLegacyCatalogPath(DirectoryInfo gameDataDirectory)
|
||||
public static string GetLegacyItemCatalogPath(DirectoryInfo gameDataDirectory)
|
||||
{
|
||||
return Path.Combine(gameDataDirectory.FullName, "AetherDB.msgpack");
|
||||
}
|
||||
|
||||
public static ILegacyCatalogReader GetCatalog(DirectoryInfo gameDataDirectory)
|
||||
public static ILegacyItemCatalogReader GetCatalog(DirectoryInfo gameDataDirectory)
|
||||
{
|
||||
if (_catalogCache != null) return _catalogCache;
|
||||
|
||||
_catalogCache = new LegacyCatalogCache();
|
||||
_catalogCache.AddBackingStore(new SingleFileMessagePackBackingStore(GetLegacyCatalogPath(gameDataDirectory)));
|
||||
_catalogCache = new LegacyItemCatalogCache();
|
||||
_catalogCache.AddBackingStore(new SingleFileMessagePackBackingStore(GetLegacyItemCatalogPath(gameDataDirectory)));
|
||||
_catalogCache.PullAllBackingStores();
|
||||
DatabaseLinkBase.BindLegacyCatalog(_catalogCache);
|
||||
DatabaseLinkBase.BindLegacyItemCatalog(_catalogCache);
|
||||
return _catalogCache;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public abstract class DatabaseEntry
|
|||
public class DatabaseLink<T> : DatabaseLinkBase where T : ItemData
|
||||
{
|
||||
[IgnoreMember]
|
||||
public T Value => ResolveLegacyCatalog<T>(LinkID);
|
||||
public T Value => ResolveLegacyItemCatalog<T>(LinkID);
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
@ -78,17 +78,17 @@ public class DatabaseLinkBase
|
|||
public Guid LinkID;
|
||||
|
||||
[IgnoreMember]
|
||||
private static ILegacyCatalogReader Catalog { get; set; }
|
||||
private static ILegacyItemCatalogReader Catalog { get; set; }
|
||||
|
||||
protected static T ResolveLegacyCatalog<T>(Guid linkId) where T : ItemData
|
||||
protected static T ResolveLegacyItemCatalog<T>(Guid linkId) where T : ItemData
|
||||
{
|
||||
if (Catalog == null)
|
||||
throw new InvalidOperationException("Legacy item link resolution is not bound. Open LegacyCatalogBoundary before reading legacy item object graphs.");
|
||||
throw new InvalidOperationException("Legacy item link resolution is not bound. Open LegacyItemCatalogBoundary before reading legacy item object graphs.");
|
||||
|
||||
return Catalog.Get<T>(linkId);
|
||||
}
|
||||
|
||||
public static void BindLegacyCatalog(ILegacyCatalogReader catalog)
|
||||
public static void BindLegacyItemCatalog(ILegacyItemCatalogReader catalog)
|
||||
{
|
||||
if (catalog == null) throw new ArgumentNullException(nameof(catalog));
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ using System.IO;
|
|||
using MessagePack;
|
||||
using UniRx;
|
||||
|
||||
public interface ILegacyCatalogReader
|
||||
public interface ILegacyItemCatalogReader
|
||||
{
|
||||
ItemData Get(Guid guid);
|
||||
T Get<T>(Guid guid) where T : ItemData;
|
||||
}
|
||||
|
||||
public class LegacyCatalogCache : ILegacyCatalogReader
|
||||
public class LegacyItemCatalogCache : ILegacyItemCatalogReader
|
||||
{
|
||||
|
||||
private readonly object addLock = new object();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class ItemManager
|
|||
|
||||
// private Guid _forceLoadZone;
|
||||
|
||||
private readonly ILegacyCatalogReader _itemData;
|
||||
private readonly ILegacyItemCatalogReader _itemData;
|
||||
public GameplaySettings GameplaySettings { get; }
|
||||
|
||||
// public double Time
|
||||
|
|
@ -46,7 +46,7 @@ public class ItemManager
|
|||
|
||||
// private readonly Dictionary<CraftedItemData, int> Tier = new Dictionary<CraftedItemData, int>();
|
||||
|
||||
public ItemManager(ILegacyCatalogReader itemData, GameplaySettings settings, Action<string> logger)
|
||||
public ItemManager(ILegacyItemCatalogReader itemData, GameplaySettings settings, Action<string> logger)
|
||||
{
|
||||
_itemData = itemData;
|
||||
GameplaySettings = settings;
|
||||
|
|
|
|||
Loading…
Reference in a new issue