Rename trade cargo selector surface model

This commit is contained in:
Meta Vens 2026-06-28 15:35:36 +01:00
commit 14cbc92677
4 changed files with 33 additions and 31 deletions

View file

@ -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<string, (EquippedCargoBay Cargo, string Label)> _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))

View file

@ -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<TradeRow> 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."

View file

@ -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<AetheriaRuntimeStationCargoTargetRow>();
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<AetheriaRuntimeTradeCargoProjectionOption>();
var targets = new List<AetheriaRuntimeTradeCargoModelOption>();
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<AetheriaRuntimeStationCargoTargetRow>())
.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"));

View file

@ -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<string, AetheriaRuntimeTradeCargoSelection> 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<AetheriaRuntimeTradeCargoProjectionOption> targets,
IEnumerable<AetheriaRuntimeTradeCargoModelOption> targets,
string updatedAtUtc)
{
var options = new List<AetheriaRuntimeTradeCargoTargetOption>();
var selections = new Dictionary<string, AetheriaRuntimeTradeCargoSelection>(StringComparer.Ordinal);
foreach (var target in targets ?? Array.Empty<AetheriaRuntimeTradeCargoProjectionOption>())
foreach (var target in targets ?? Array.Empty<AetheriaRuntimeTradeCargoModelOption>())
{
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<AetheriaRuntimeSurfaceComponent>());
}
private static string CommandFor(AetheriaRuntimeTradeCargoProjectionOption target)
private static string CommandFor(AetheriaRuntimeTradeCargoModelOption target)
{
switch (target.Kind)
{