Build inventory dropdown model directly
This commit is contained in:
parent
c29bad6a1c
commit
80cda5245b
3 changed files with 34 additions and 22 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<AetheriaRuntimeStationRefitEntityOption>())
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -151,17 +151,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public sealed class AetheriaRuntimeInventoryDropdownSurfaceModel
|
||||
{
|
||||
public AetheriaRuntimeInventoryDropdownSurfaceModel(
|
||||
AetheriaRuntimeInventoryDropdownSurfaceState state,
|
||||
AetheriaRuntimeSurfaceDocument document,
|
||||
IReadOnlyDictionary<string, AetheriaRuntimeInventoryDropdownSelection> selections)
|
||||
{
|
||||
State = state ?? new AetheriaRuntimeInventoryDropdownSurfaceState(
|
||||
"",
|
||||
Array.Empty<AetheriaRuntimeInventoryDropdownGroup>(),
|
||||
"");
|
||||
Document = document ?? AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build(
|
||||
new AetheriaRuntimeInventoryDropdownSurfaceState(
|
||||
"",
|
||||
Array.Empty<AetheriaRuntimeInventoryDropdownGroup>(),
|
||||
""));
|
||||
Selections = selections ?? new Dictionary<string, AetheriaRuntimeInventoryDropdownSelection>(StringComparer.Ordinal);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeInventoryDropdownSurfaceState State { get; }
|
||||
public AetheriaRuntimeSurfaceDocument Document { get; }
|
||||
public IReadOnlyDictionary<string, AetheriaRuntimeInventoryDropdownSelection> 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<AetheriaRuntimeInventoryDropdownEntityOption> 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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue