From 14cbc926774249c0eeae0036fde0c1ce72a0db0f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 15:35:36 +0100 Subject: [PATCH] Rename trade cargo selector surface model --- Aetheria.State.Verify/Program.cs | 22 ++++++++++--------- .../scripts/verify-stage7d-unity-parity.ps1 | 4 ++-- Assets/Scripts/UI/Menu/TradeMenu.cs | 18 +++++++-------- ...RuntimeTradeCargoSelectorSurfaceBuilder.cs | 20 ++++++++--------- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 0956362e4..a34428433 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -5655,16 +5655,16 @@ static void RequireTradeCargoSelectorUseEveSurface(string root) var requiredSymbols = new[] { "RenderCargoSelectorSurface(", - "_cargoSelectorSurfaceProjection = ProjectTradeCargoSelectorSurface();", + "_cargoSelectorSurfaceModel = ComposeTradeCargoSelectorSurface();", "HandleCargoSelectorSurfaceCommand(", "AetheriaEveUnitySurfaceHost.RenderRuntime(", "AetheriaEveUnitySurfaceHost.Hide(_cargoSelectorSurfaceDocument)", - "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Build(_cargoSelectorSurfaceProjection.State)", - "ProjectTradeCargoSelectorSurface(", - "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Project(", - "_cargoSelectorSurfaceProjection?.TryResolve(command.Command, out var selection) == true", + "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Build(_cargoSelectorSurfaceModel.State)", + "ComposeTradeCargoSelectorSurface(", + "AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Compose(", + "_cargoSelectorSurfaceModel?.TryResolve(command.Command, out var selection) == true", "ApplyCargoSelection(", - "new AetheriaRuntimeTradeCargoProjectionOption(", + "new AetheriaRuntimeTradeCargoModelOption(", "AetheriaRuntimeTradeCargoTargetKind.DockingBay", "AetheriaRuntimeTradeCargoTargetKind.ShipBay", "AetheriaRuntimeTradeCargoSelectorSurfaceCommands.TryRead(request, out var command)", @@ -5710,6 +5710,8 @@ static void RequireTradeCargoSelectorUseEveSurface(string root) "private readonly Dictionary _cargoSelectionCommands", "BuildCargoSelectionCommands(", "ProjectTradeCargoSelectorSurfaceState(", + "ProjectTradeCargoSelectorSurface(", + "_cargoSelectorSurfaceProjection", "GameManager.DockedEntity.Children", "GameManager.CurrentEntity.Parent.Children", "GameManager.DockingBay", @@ -5761,16 +5763,16 @@ static void RequireTradeCargoSelectorUseEveSurface(string root) "public static bool TryRead(", "AetheriaRuntimeTradeCargoSelectorSurfaceState", "AetheriaRuntimeTradeCargoTargetOption", - "AetheriaRuntimeTradeCargoProjectionOption", + "AetheriaRuntimeTradeCargoModelOption", "AetheriaRuntimeTradeCargoTargetKind", "AetheriaRuntimeTradeCargoSelection", - "AetheriaRuntimeTradeCargoSelectorSurfaceProjection", + "AetheriaRuntimeTradeCargoSelectorSurfaceModel", "public static string ShipBayCommand(", - "public static AetheriaRuntimeTradeCargoSelectorSurfaceProjection Project(", + "public static AetheriaRuntimeTradeCargoSelectorSurfaceModel Compose(", "public bool TryResolve(string command, out AetheriaRuntimeTradeCargoSelection selection)", "public static AetheriaRuntimeSurfaceDocument Build(", "providerKind: \"trade.menu\"", - "The observing client projects available cargo targets; the shared runtime surface owns the cargo selector contract." + "The observing client lists available cargo targets; the shared runtime surface owns the cargo selector contract." }; var missingBuilderSymbols = requiredBuilderSymbols .Where(symbol => !tradeCargoSelectorSurfaceBuilder.Contains(symbol, StringComparison.Ordinal)) diff --git a/Aetheria.State/scripts/verify-stage7d-unity-parity.ps1 b/Aetheria.State/scripts/verify-stage7d-unity-parity.ps1 index 8af78c4ca..51f62fcc5 100644 --- a/Aetheria.State/scripts/verify-stage7d-unity-parity.ps1 +++ b/Aetheria.State/scripts/verify-stage7d-unity-parity.ps1 @@ -220,9 +220,9 @@ Assert-NotContains $tradeMenu "stationInventory" "TradeMenu must not recover sta Assert-NotMatches $tradeMenu "void Populate\(\)[\s\S]*?Inventory\.Cargo\.Keys[\s\S]*?private IEnumerable BuildStationStockRows" "TradeMenu Populate must not enumerate Unity cargo as station stock truth." Assert-NotMatches $tradeMenu "RequestTradePurchase\([\s\S]*?Cargo\.TryGetValue[\s\S]*?private bool TryResolveCargoBay" "TradeMenu trade purchase command source must not come from Unity cargo lookup." Assert-NotMatches $tradeMenu "OnEnable\(\)[\s\S]*?TryGetObservedDockingBay[\s\S]*?void Populate" "TradeMenu OnEnable must not read manager docking-bay identity directly." -Assert-NotMatches $tradeMenu "ProjectTradeCargoSelectorSurface[\s\S]*?TryGetObservedDockingBay[\s\S]*?private void ApplyCargoSelection" "TradeMenu cargo selector projection must not read manager docking-bay identity directly." +Assert-NotMatches $tradeMenu "ComposeTradeCargoSelectorSurface[\s\S]*?TryGetObservedDockingBay[\s\S]*?private void ApplyCargoSelection" "TradeMenu cargo selector model must not read manager docking-bay identity directly." Assert-NotMatches $tradeMenu "ApplyCargoSelection[\s\S]*?TryGetObservedDockingBay[\s\S]*?private void SetTargetCargo" "TradeMenu cargo selector selection must not read manager docking-bay identity directly." -Assert-NotMatches $tradeMenu "ProjectTradeCargoSelectorSurface[\s\S]*?ObservedAvailableEntities[\s\S]*?private void ApplyCargoSelection" "TradeMenu cargo selector projection must use typed station-refit options." +Assert-NotMatches $tradeMenu "ComposeTradeCargoSelectorSurface[\s\S]*?ObservedAvailableEntities[\s\S]*?private void ApplyCargoSelection" "TradeMenu cargo selector model must use typed station-refit options." Assert-NotMatches $tradeMenu "ApplyCargoSelection[\s\S]*?ObservedAvailableEntities[\s\S]*?private void SetTargetCargo" "TradeMenu cargo selector selection must resolve options from typed station-refit keys." Assert-NotMatches $tradeMenu "private int CountAvailablePlayerShips\([^)]*\)\s*\{[\s\S]*?ObservedAvailableEntities[\s\S]*?\n \}" "TradeMenu available-ship counts must come from typed station-refit state." Assert-NotContains $tradeMenu "HullItemKey" "TradeMenu owned ship counts must come from station stock facts, not UI-side hull comparisons." diff --git a/Assets/Scripts/UI/Menu/TradeMenu.cs b/Assets/Scripts/UI/Menu/TradeMenu.cs index 3f62a9f7d..05c9e3f86 100644 --- a/Assets/Scripts/UI/Menu/TradeMenu.cs +++ b/Assets/Scripts/UI/Menu/TradeMenu.cs @@ -43,7 +43,7 @@ public class TradeMenu : MonoBehaviour private readonly AetheriaEveUnitySurfaceChrome _filterSurfaceChrome = PanelChrome(420f, 520f, Align.FlexStart); private readonly AetheriaEveUnitySurfaceChrome _rowActionSurfaceChrome = PanelChrome(320f, 360f, Align.FlexStart); private readonly AetheriaEveUnitySurfaceChrome _tradeItemSurfaceChrome = PanelChrome(420f, 520f, Align.FlexStart); - private AetheriaRuntimeTradeCargoSelectorSurfaceProjection _cargoSelectorSurfaceProjection; + private AetheriaRuntimeTradeCargoSelectorSurfaceModel _cargoSelectorSurfaceModel; private AetheriaRuntimeStationCargoTargetRow[] _cargoSelectorStationRefitTargets = Array.Empty(); private AetheriaRuntimeStationRefitDocument _stationRefit; @@ -1130,13 +1130,13 @@ public class TradeMenu : MonoBehaviour private void RenderCargoSelectorSurface() { - _cargoSelectorSurfaceProjection = ProjectTradeCargoSelectorSurface(); + _cargoSelectorSurfaceModel = ComposeTradeCargoSelectorSurface(); _cargoSelectorSurfaceDocument = AetheriaEveUnitySurfaceHost.RenderRuntime( transform, _cargoSelectorSurfaceDocument, "Aetheria Trade Cargo Selector Surface", - AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Build(_cargoSelectorSurfaceProjection.State), + AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Build(_cargoSelectorSurfaceModel.State), HandleCargoSelectorSurfaceCommand, _cargoSelectorSurfaceChrome); } @@ -1156,7 +1156,7 @@ public class TradeMenu : MonoBehaviour } if (command.Kind == AetheriaRuntimeTradeCargoSelectorCommandKind.Select && - _cargoSelectorSurfaceProjection?.TryResolve(command.Command, out var selection) == true) + _cargoSelectorSurfaceModel?.TryResolve(command.Command, out var selection) == true) { ApplyCargoSelection(selection); HideCargoSelectorSurface(); @@ -1194,15 +1194,15 @@ public class TradeMenu : MonoBehaviour }; } - private AetheriaRuntimeTradeCargoSelectorSurfaceProjection ProjectTradeCargoSelectorSurface() + private AetheriaRuntimeTradeCargoSelectorSurfaceModel ComposeTradeCargoSelectorSurface() { - var targets = new List(); + var targets = new List(); var stationRefit = ResolveStationRefit(); if (stationRefit?.IsDocked == true && !string.IsNullOrWhiteSpace(stationRefit.DockParentEntityKey) && stationRefit.DockingBayIndex >= 0) { - targets.Add(new AetheriaRuntimeTradeCargoProjectionOption( + targets.Add(new AetheriaRuntimeTradeCargoModelOption( AetheriaRuntimeTradeCargoTargetKind.DockingBay, "Docking Bay", stationRefit.DockParentEntityKey, @@ -1214,7 +1214,7 @@ public class TradeMenu : MonoBehaviour Array.Empty()) .ToArray(); targets.AddRange(_cargoSelectorStationRefitTargets - .Select(target => new AetheriaRuntimeTradeCargoProjectionOption( + .Select(target => new AetheriaRuntimeTradeCargoModelOption( target.Kind, target.Label, target.EntityKey, @@ -1222,7 +1222,7 @@ public class TradeMenu : MonoBehaviour target.BayIndex, IsTargetCargoBayKey(target.EntityKey, target.BayIndex)))); - return AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Project( + return AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.Compose( _targetCargoLabel ?? "", targets, DateTime.UtcNow.ToString("O")); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.cs index 22716cf22..2a8442ea0 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeTradeCargoSelectorSurfaceBuilder.cs @@ -43,9 +43,9 @@ namespace GameCult.Aetheria.State.Verse ShipBay = 2 } - public sealed class AetheriaRuntimeTradeCargoProjectionOption + public sealed class AetheriaRuntimeTradeCargoModelOption { - public AetheriaRuntimeTradeCargoProjectionOption( + public AetheriaRuntimeTradeCargoModelOption( AetheriaRuntimeTradeCargoTargetKind kind, string label, string entityKey = "", @@ -95,9 +95,9 @@ namespace GameCult.Aetheria.State.Verse public int BayIndex { get; } } - public sealed class AetheriaRuntimeTradeCargoSelectorSurfaceProjection + public sealed class AetheriaRuntimeTradeCargoSelectorSurfaceModel { - public AetheriaRuntimeTradeCargoSelectorSurfaceProjection( + public AetheriaRuntimeTradeCargoSelectorSurfaceModel( AetheriaRuntimeTradeCargoSelectorSurfaceState state, IReadOnlyDictionary selections) { @@ -128,15 +128,15 @@ namespace GameCult.Aetheria.State.Verse return $"{SurfaceId}.ship_{shipIndex}_bay_{bayIndex}"; } - public static AetheriaRuntimeTradeCargoSelectorSurfaceProjection Project( + public static AetheriaRuntimeTradeCargoSelectorSurfaceModel Compose( string currentTarget, - IEnumerable targets, + IEnumerable targets, string updatedAtUtc) { var options = new List(); var selections = new Dictionary(StringComparer.Ordinal); - foreach (var target in targets ?? Array.Empty()) + foreach (var target in targets ?? Array.Empty()) { if (target == null || target.IsCurrent || @@ -165,7 +165,7 @@ namespace GameCult.Aetheria.State.Verse target.BayIndex); } - return new AetheriaRuntimeTradeCargoSelectorSurfaceProjection( + return new AetheriaRuntimeTradeCargoSelectorSurfaceModel( new AetheriaRuntimeTradeCargoSelectorSurfaceState( currentTarget, options, @@ -204,7 +204,7 @@ namespace GameCult.Aetheria.State.Verse Metric($"{SurfaceId}.current", "Current", state.CurrentTarget), Text( $"{SurfaceId}.note", - "The observing client projects available cargo targets; the shared runtime surface owns the cargo selector contract."), + "The observing client lists available cargo targets; the shared runtime surface owns the cargo selector contract."), ButtonColumn( $"{SurfaceId}.options", targets @@ -271,7 +271,7 @@ namespace GameCult.Aetheria.State.Verse children ?? Array.Empty()); } - private static string CommandFor(AetheriaRuntimeTradeCargoProjectionOption target) + private static string CommandFor(AetheriaRuntimeTradeCargoModelOption target) { switch (target.Kind) {