Narrow legacy catalog to item hydration
This commit is contained in:
parent
596534896f
commit
9655d5ad7b
7 changed files with 21 additions and 29 deletions
Binary file not shown.
|
|
@ -81,7 +81,6 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior
|
|||
if (_scanTime > ScanDuration)
|
||||
{
|
||||
// TODO: Implement Scanning!
|
||||
//Context.ItemData.Get<Corporation>(Entity.Corporation).PlanetSurveyFloor[ScanTarget] = MinimumDensity;
|
||||
_scanTime = 0;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -94,7 +93,6 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior
|
|||
_scanTime += dt;
|
||||
if (_scanTime > ScanDuration)
|
||||
{
|
||||
//Context.ItemData.Get<Corporation>(Entity.Corporation).PlanetSurveyFloor[ScanTarget] = MinimumDensity;
|
||||
_scanTime = 0;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -110,4 +108,4 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior
|
|||
MinimumDensity = Evaluate(_data.MinimumDensity);
|
||||
ScanDuration = Evaluate(_data.ScanDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public abstract class DatabaseEntry
|
|||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class DatabaseLink<T> : DatabaseLinkBase where T : DatabaseEntry
|
||||
public class DatabaseLink<T> : DatabaseLinkBase where T : ItemData
|
||||
{
|
||||
[IgnoreMember]
|
||||
public T Value => ResolveLegacyCatalog<T>(LinkID);
|
||||
|
|
@ -80,10 +80,10 @@ public class DatabaseLinkBase
|
|||
[IgnoreMember]
|
||||
private static ILegacyCatalogReader Catalog { get; set; }
|
||||
|
||||
protected static T ResolveLegacyCatalog<T>(Guid linkId) where T : DatabaseEntry
|
||||
protected static T ResolveLegacyCatalog<T>(Guid linkId) where T : ItemData
|
||||
{
|
||||
if (Catalog == null)
|
||||
throw new InvalidOperationException("Legacy DatabaseLink resolution is not bound. Open LegacyCatalogBoundary before reading legacy catalog object graphs.");
|
||||
throw new InvalidOperationException("Legacy item link resolution is not bound. Open LegacyCatalogBoundary before reading legacy item object graphs.");
|
||||
|
||||
return Catalog.Get<T>(linkId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ using UniRx;
|
|||
|
||||
public interface ILegacyCatalogReader
|
||||
{
|
||||
DatabaseEntry Get(Guid guid);
|
||||
T Get<T>(Guid guid) where T : DatabaseEntry;
|
||||
ItemData Get(Guid guid);
|
||||
T Get<T>(Guid guid) where T : ItemData;
|
||||
}
|
||||
|
||||
public class LegacyCatalogCache : ILegacyCatalogReader
|
||||
|
|
@ -21,7 +21,7 @@ public class LegacyCatalogCache : ILegacyCatalogReader
|
|||
|
||||
private List<CacheBackingStore> _backingStores = new List<CacheBackingStore>();
|
||||
|
||||
private readonly Dictionary<Guid, DatabaseEntry> _entries = new Dictionary<Guid, DatabaseEntry>();
|
||||
private readonly Dictionary<Guid, ItemData> _entries = new Dictionary<Guid, ItemData>();
|
||||
|
||||
public void AddBackingStore(CacheBackingStore store)
|
||||
{
|
||||
|
|
@ -41,21 +41,21 @@ public class LegacyCatalogCache : ILegacyCatalogReader
|
|||
{
|
||||
lock(addLock)
|
||||
{
|
||||
if (entry != null)
|
||||
if (entry is ItemData item)
|
||||
{
|
||||
_entries[entry.ID] = entry;
|
||||
_entries[item.ID] = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DatabaseEntry Get(Guid guid)
|
||||
public ItemData Get(Guid guid)
|
||||
{
|
||||
DatabaseEntry entry;
|
||||
ItemData entry;
|
||||
_entries.TryGetValue(guid, out entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
public T Get<T>(Guid guid) where T : DatabaseEntry
|
||||
public T Get<T>(Guid guid) where T : ItemData
|
||||
{
|
||||
return Get(guid) as T;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ using float2 = Unity.Mathematics.float2;
|
|||
|
||||
public static class Extensions
|
||||
{
|
||||
//public static IDatabaseEntry Get(this Guid entry) => Database.Get(entry);
|
||||
//public static T Get<T>(this Guid entry) where T : class, IDatabaseEntry => Database.Get(entry) as T;
|
||||
|
||||
public static bool IsImplementationOf(this Type baseType, Type interfaceType)
|
||||
{
|
||||
return baseType.GetInterfaces().Any(interfaceType.Equals);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class ItemManager
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public T GetCatalogEntry<T>(Guid id) where T : DatabaseEntry
|
||||
public T GetCatalogEntry<T>(Guid id) where T : ItemData
|
||||
{
|
||||
return _itemData.Get<T>(id);
|
||||
}
|
||||
|
|
@ -63,15 +63,6 @@ public class ItemManager
|
|||
_logger(s);
|
||||
}
|
||||
|
||||
// public int ItemTier(CraftedItemData itemData)
|
||||
// {
|
||||
// if (Tier.ContainsKey(itemData)) return Tier[itemData];
|
||||
//
|
||||
// Tier[itemData] = itemData.Ingredients.Keys.Max(ci => _cache.Get<ItemData>(ci) is CraftedItemData craftableIngredient ? ItemTier(craftableIngredient) : 0);
|
||||
//
|
||||
// return Tier[itemData];
|
||||
// }
|
||||
|
||||
public SimpleCommodityData GetData(SimpleCommodity item)
|
||||
{
|
||||
return item.Data.Value as SimpleCommodityData;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
`LegacyCatalogBoundary`, which opens `LegacyCatalogCache` as the only
|
||||
concrete pull-only catalog cache. Runtime consumers receive
|
||||
`ILegacyCatalogReader`, so the old `AetherDB.msgpack` backing store may hydrate
|
||||
in-memory item domain objects for the current Unity runtime, but this path cannot
|
||||
in-memory item domain objects for the current Unity runtime, but the cache now
|
||||
admits only `ItemData` entries and cannot resolve generic `DatabaseEntry`
|
||||
object graphs. This path cannot
|
||||
push or delete legacy files. The legacy backing-store
|
||||
write/realtime APIs, public cache mutation methods, enumeration methods, and
|
||||
global-setting lookup methods have been deleted; only backing-store pull
|
||||
|
|
@ -270,7 +272,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
`Aetheria.State.Unity` facade maps typed `.cc` documents into the same
|
||||
contract for full .NET smokes and Eve surface reads. Neither writes state or
|
||||
owns simulation. The legacy cache no longer has a public mutation surface, but
|
||||
it still materializes `ItemManager`. Item properties manufacturer display is
|
||||
it still materializes `ItemManager`. The legacy cache is item-only; old
|
||||
`Faction`, `NameFile`, global, zone, player, task, and body entries are no
|
||||
longer accepted as runtime catalog entries. Item properties manufacturer display is
|
||||
a typed snapshot consumer; loadout generation is the remaining runtime
|
||||
single-ID item hydration bridge. The old trade debug UI and console `give`
|
||||
command have been deleted. No live
|
||||
|
|
@ -445,6 +449,8 @@ First Aetheria surfaces to publish:
|
|||
- Done: remove `GameData/NameFile/*.msgpack` from Unity runtime legacy
|
||||
catalog boot; typed name files now own runtime names, and old name files
|
||||
remain migration inputs only.
|
||||
- Done: narrow `ILegacyCatalogReader` and `DatabaseLink<T>` to `ItemData`;
|
||||
`LegacyCatalogCache` ignores non-item entries from `AetherDB.msgpack`.
|
||||
- Replace `ActionGameManager` cache bootstrap with the new state runtime.
|
||||
- Convert domain references from GUID/base-class patterns to typed record
|
||||
refs.
|
||||
|
|
|
|||
Loading…
Reference in a new issue