Name item catalog bridge as projection

This commit is contained in:
Meta Vens 2026-06-13 23:10:48 +01:00
commit b9377a112a
6 changed files with 39 additions and 30 deletions

View file

@ -6,13 +6,13 @@ using System.Reflection;
using GameCult.Aetheria.State.Unity;
using Unity.Mathematics;
public interface IRuntimeItemCatalogReader
public interface IRuntimeItemProjectionReader
{
ItemData Get(Guid guid);
T Get<T>(Guid guid) where T : ItemData;
}
public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemCatalogReader
public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemProjectionReader
{
private readonly Dictionary<Guid, ItemData> _items;
private static readonly IReadOnlyDictionary<int, Type> BehaviorTypesByUnionKey = new Dictionary<int, Type>

View file

@ -29,7 +29,7 @@ public class ItemManager
// private Guid _forceLoadZone;
private readonly IRuntimeItemCatalogReader _itemData;
private readonly IRuntimeItemProjectionReader _itemProjections;
public GameplaySettings GameplaySettings { get; }
// public double Time
@ -45,16 +45,16 @@ public class ItemManager
// private readonly Dictionary<CraftedItemData, int> Tier = new Dictionary<CraftedItemData, int>();
public ItemManager(IRuntimeItemCatalogReader itemData, GameplaySettings settings, Action<string> logger)
public ItemManager(IRuntimeItemProjectionReader itemProjections, GameplaySettings settings, Action<string> logger)
{
_itemData = itemData;
_itemProjections = itemProjections;
GameplaySettings = settings;
_logger = logger;
}
public T GetCatalogEntry<T>(Guid id) where T : ItemData
public T GetRuntimeItemProjection<T>(Guid id) where T : ItemData
{
return _itemData.Get<T>(id);
return _itemProjections.Get<T>(id);
}
public RuntimeItemReference CreateReference(ItemData item)
@ -75,7 +75,7 @@ public class ItemManager
return;
}
var data = _itemData.Get(item.Data.ItemId);
var data = _itemProjections.Get(item.Data.ItemId);
if (data == null)
{
_logger($"Attempted to hydrate missing item id {item.Data.ItemId}");

View file

@ -181,7 +181,7 @@ public class LoadoutGenerator
private T ProjectRuntimeItem<T>(AetheriaRuntimeCatalogItem item) where T : EquippableItemData
{
return Guid.TryParse(item.LegacyId, out var legacyId)
? ItemManager.GetCatalogEntry<T>(legacyId)
? ItemManager.GetRuntimeItemProjection<T>(legacyId)
: null;
}