From 80cda5245b6318783dc7dde282754208c3e0a270 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 29 Jun 2026 05:44:24 +0100 Subject: [PATCH] Build inventory dropdown model directly --- Aetheria.State.Verify/Program.cs | 21 +++++++++++---- Assets/Scripts/UI/Menu/InventoryPanel.cs | 8 +++--- ...aRuntimeInventoryDropdownSurfaceBuilder.cs | 27 ++++++++++--------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 07c18eaaa..8454487d4 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -6432,14 +6432,14 @@ static void RequireInventoryDropdownUseEveSurface(string root) var requiredSymbols = new[] { "RenderDropdownSurface(", - "ComposeDropdownSurface(", - "_dropdownSurfaceModel = ComposeDropdownSurface();", + "BuildDropdownSurfaceModel(", + "_dropdownSurfaceModel = BuildDropdownSurfaceModel();", "HandleDropdownSurfaceCommand(", "ExecuteDropdownSelection(", "AetheriaEveUnitySurfaceHost.RenderRuntime(", "AetheriaEveUnitySurfaceHost.Hide(_dropdownSurfaceDocument)", - "AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build(_dropdownSurfaceModel.State)", - "AetheriaRuntimeInventoryDropdownSurfaceBuilder.Compose(", + "_dropdownSurfaceModel.Document", + "AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build(", "AetheriaRuntimeInventoryDropdownSurfaceCommands.TryRead(request, out var command)", "AetheriaRuntimeInventoryDropdownCommandKind.Close", "AetheriaRuntimeInventoryDropdownCommandKind.Select", @@ -6495,6 +6495,9 @@ static void RequireInventoryDropdownUseEveSurface(string root) "BuildDropdownCommands(", "ProjectDropdownSurfaceState(", "ProjectDropdownSurface(", + "ComposeDropdownSurface(", + "_dropdownSurfaceModel.State", + "AetheriaRuntimeInventoryDropdownSurfaceBuilder.Compose(", "_dropdownSurfaceProjection", "GameManager.DockingBay", "GameManager.AvailableEntities()", @@ -6570,9 +6573,10 @@ static void RequireInventoryDropdownUseEveSurface(string root) "AetheriaRuntimeInventoryDropdownLoadoutOption", "AetheriaRuntimeInventoryDropdownSelectionKind", "AetheriaRuntimeInventoryDropdownSurfaceModel", + "public AetheriaRuntimeSurfaceDocument Document { get; }", "public string EntityKey { get; }", "entityKey: entity.EntityKey", - "public static AetheriaRuntimeInventoryDropdownSurfaceModel Compose(", + "public static AetheriaRuntimeInventoryDropdownSurfaceModel Build(", "public bool TryResolve(", "public static string EntityEquipmentCommand(", "public static string EntityBayCommand(", @@ -6591,6 +6595,13 @@ static void RequireInventoryDropdownUseEveSurface(string root) "Shared runtime inventory dropdown surface builder no longer owns the inventory dropdown shell contract: " + string.Join(", ", missingBuilderSymbols)); } + + if (inventoryDropdownSurfaceBuilder.Contains("public AetheriaRuntimeInventoryDropdownSurfaceState State { get; }", StringComparison.Ordinal) || + inventoryDropdownSurfaceBuilder.Contains("public static AetheriaRuntimeInventoryDropdownSurfaceModel Compose(", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Shared runtime inventory dropdown builder must return a model with a finished surface document; do not re-expose Compose or a public State handoff."); + } } static void RequireStationRefitDockingBaysUseTypedDocuments(string root) diff --git a/Assets/Scripts/UI/Menu/InventoryPanel.cs b/Assets/Scripts/UI/Menu/InventoryPanel.cs index 10b572a11..a844b112f 100644 --- a/Assets/Scripts/UI/Menu/InventoryPanel.cs +++ b/Assets/Scripts/UI/Menu/InventoryPanel.cs @@ -215,13 +215,13 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler private void RenderDropdownSurface() { - _dropdownSurfaceModel = ComposeDropdownSurface(); + _dropdownSurfaceModel = BuildDropdownSurfaceModel(); _dropdownSurfaceDocument = AetheriaEveUnitySurfaceHost.RenderRuntime( transform, _dropdownSurfaceDocument, "Aetheria Inventory Dropdown Surface", - AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build(_dropdownSurfaceModel.State), + _dropdownSurfaceModel.Document, HandleDropdownSurfaceCommand, _dropdownSurfaceChrome); } @@ -299,7 +299,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler AetheriaEveUnitySurfaceHost.Hide(_dropdownSurfaceDocument); } - private AetheriaRuntimeInventoryDropdownSurfaceModel ComposeDropdownSurface() + private AetheriaRuntimeInventoryDropdownSurfaceModel BuildDropdownSurfaceModel() { var stationRefit = ResolveStationRefit(); _dropdownStationRefitEntities = (stationRefit?.AvailableEntities ?? Array.Empty()) @@ -328,7 +328,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler .ToArray(); var hasDockingBay = TryResolveCurrentDockingBayRow(out var currentDockingBay); - return AetheriaRuntimeInventoryDropdownSurfaceBuilder.Compose( + return AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build( Title?.text ?? "None", entityOptions, hasDockingBay, diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInventoryDropdownSurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInventoryDropdownSurfaceBuilder.cs index a805deff0..e7967dfb1 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInventoryDropdownSurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInventoryDropdownSurfaceBuilder.cs @@ -151,17 +151,18 @@ namespace GameCult.Aetheria.State.Verse public sealed class AetheriaRuntimeInventoryDropdownSurfaceModel { public AetheriaRuntimeInventoryDropdownSurfaceModel( - AetheriaRuntimeInventoryDropdownSurfaceState state, + AetheriaRuntimeSurfaceDocument document, IReadOnlyDictionary selections) { - State = state ?? new AetheriaRuntimeInventoryDropdownSurfaceState( - "", - Array.Empty(), - ""); + Document = document ?? AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build( + new AetheriaRuntimeInventoryDropdownSurfaceState( + "", + Array.Empty(), + "")); Selections = selections ?? new Dictionary(StringComparer.Ordinal); } - public AetheriaRuntimeInventoryDropdownSurfaceState State { get; } + public AetheriaRuntimeSurfaceDocument Document { get; } public IReadOnlyDictionary Selections { get; } public bool TryResolve( @@ -199,7 +200,7 @@ namespace GameCult.Aetheria.State.Verse return $"{SurfaceId}.loadout_{templateIndex}"; } - public static AetheriaRuntimeInventoryDropdownSurfaceModel Compose( + public static AetheriaRuntimeInventoryDropdownSurfaceModel Build( string currentView, IEnumerable entities, bool hasDockingBay, @@ -334,12 +335,12 @@ namespace GameCult.Aetheria.State.Verse loadoutOptions)); } - return new AetheriaRuntimeInventoryDropdownSurfaceModel( - new AetheriaRuntimeInventoryDropdownSurfaceState( - currentView, - groups, - updatedAtUtc), - selections); + var state = new AetheriaRuntimeInventoryDropdownSurfaceState( + currentView, + groups, + updatedAtUtc); + + return new AetheriaRuntimeInventoryDropdownSurfaceModel(Build(state), selections); } public static AetheriaRuntimeSurfaceDocument Build(