Prefilter trade rows with typed catalog
This commit is contained in:
parent
05c3e88b10
commit
738fa00eca
4 changed files with 56 additions and 2 deletions
Binary file not shown.
|
|
@ -76,6 +76,9 @@ not catalog entry access.
|
|||
Loadout generation now applies typed catalog prefilters for item category,
|
||||
hardpoint type, shape fit, hull type, and behavior kind before hydrating legacy
|
||||
`ItemData` projections for final simulation compatibility.
|
||||
The surviving trade menu also applies typed catalog prefilters for row size,
|
||||
hardpoint type, and behavior kind before hydrating `ItemData` projections for
|
||||
legacy commodity filters, columns, and buy actions.
|
||||
Surviving item catalog Unity DTOs inherit `RuntimeItemProjectionEntry`; the old
|
||||
`RuntimeCatalogEntry` base name no longer appears in live source. Temporary
|
||||
faction/corporation projections and zone body/orbit DTOs keep local GUID fields
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using GameCult.Aetheria.State.Unity;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
|
@ -222,6 +223,7 @@ public class TradeMenu : MonoBehaviour
|
|||
data => data.Shape.Width*data.Shape.Height));
|
||||
|
||||
var items = Inventory.Cargo.Keys
|
||||
.Where(PassesTypedTradeFilters)
|
||||
.Select<ItemInstance, (ItemInstance item, ItemData data)>(ii=>(ii, GameManager.ItemManager.GetData(ii)));
|
||||
|
||||
if (MinimumSizeFilter.gameObject.activeSelf)
|
||||
|
|
@ -355,6 +357,48 @@ public class TradeMenu : MonoBehaviour
|
|||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private bool PassesTypedTradeFilters(ItemInstance item)
|
||||
{
|
||||
var typedItem = FindTypedTradeItem(item);
|
||||
if (typedItem == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (MinimumSizeFilter.gameObject.activeSelf &&
|
||||
(MinimumSizeFilter.Width.text.Length > 0 && typedItem.ShapeWidth < int.Parse(MinimumSizeFilter.Width.text) ||
|
||||
MinimumSizeFilter.Height.text.Length > 0 && typedItem.ShapeHeight < int.Parse(MinimumSizeFilter.Height.text)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MaximumSizeFilter.gameObject.activeSelf &&
|
||||
(MaximumSizeFilter.Width.text.Length > 0 && typedItem.ShapeWidth > int.Parse(MaximumSizeFilter.Width.text) ||
|
||||
MaximumSizeFilter.Height.text.Length > 0 && typedItem.ShapeHeight > int.Parse(MaximumSizeFilter.Height.text)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_hardpointFilter.filter != null &&
|
||||
!string.Equals(typedItem.HardpointType, _hardpointFilter.type.ToString(), StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _behaviorFilters.All(filter =>
|
||||
typedItem.BehaviorKinds.Contains(filter.type.Name, StringComparer.Ordinal));
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCatalogItem FindTypedTradeItem(ItemInstance item)
|
||||
{
|
||||
if (item?.Data == null || item.Data.ItemId == Guid.Empty)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(item.Data.ItemId.ToString("D"));
|
||||
}
|
||||
|
||||
private void UpdateCreditsLabel()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -127,7 +127,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
prefilters now run against typed catalog rows before any DTO projection is hydrated. The unused `TradeMenuDebug`
|
||||
script has been deleted instead of preserving an old uGUI debug path that
|
||||
turned typed trade rows back into legacy `ItemData` objects. That hydration
|
||||
now comes from typed state, not `AetherDB.msgpack`.
|
||||
now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu
|
||||
applies typed row prefilters for size, hardpoint type, and behavior kind before
|
||||
hydrating `ItemData` projections for legacy commodity filters, columns, and
|
||||
buy actions.
|
||||
- `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`.
|
||||
Sector and tutorial generation receive the package-owned typed runtime
|
||||
catalog. `Galaxy` projects typed corporation v2 records into temporary legacy
|
||||
|
|
@ -396,7 +399,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
remaining runtime single-ID item projection bridge, but typed catalog rows own
|
||||
the loadout candidate prefilters for hull type, shape, category, hardpoint
|
||||
type, and behavior kind before that bridge is invoked. The old trade debug UI
|
||||
and console `give` command have been deleted. No live caller can enumerate
|
||||
and console `give` command have been deleted. The surviving trade menu also
|
||||
uses typed catalog rows for first-pass size, hardpoint, and behavior filters
|
||||
before hydrating row projections. No live caller can enumerate
|
||||
legacy catalog entries or request catalog-shaped single entries through
|
||||
`ItemManager`.
|
||||
- Inputs: Unity gameplay code, legacy catalog files, typed state documents, and
|
||||
|
|
@ -570,6 +575,8 @@ First Aetheria surfaces to publish:
|
|||
typed catalog rows before hydrating `HullData`/`BehaviorData` projections.
|
||||
- Done: delete unused `TradeMenuDebug`; the old debug uGUI trade path no
|
||||
longer hydrates typed trade rows back into legacy `ItemData` objects.
|
||||
- Done: move surviving trade menu size, hardpoint, and behavior filters onto
|
||||
typed catalog row prefilters before row-level `ItemData` hydration.
|
||||
- Done: delete the console `give` command instead of preserving a debug
|
||||
operator path that hydrated typed item rows back into legacy item DTOs.
|
||||
- Done: delete `ItemManager.GetCatalogEntries<T>` after all live callers
|
||||
|
|
|
|||
Loading…
Reference in a new issue