Build trade interaction models directly
This commit is contained in:
parent
9e89bb0e8b
commit
6600df0718
3 changed files with 58 additions and 41 deletions
|
|
@ -5958,21 +5958,21 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
var requiredSymbols = new[]
|
||||
{
|
||||
"RenderFilterSurface(",
|
||||
"_filterSurfaceModel = ComposeTradeFilterSurface();",
|
||||
"_filterSurfaceModel = BuildTradeFilterSurfaceModel();",
|
||||
"HandleFilterSurfaceCommand(",
|
||||
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
|
||||
"AetheriaEveUnitySurfaceHost.Hide(_filterSurfaceDocument)",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(_filterSurfaceModel.State)",
|
||||
"ComposeTradeFilterSurface(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeFilters(",
|
||||
"_filterSurfaceModel.Document",
|
||||
"BuildTradeFilterSurfaceModel(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilters(",
|
||||
"_filterSurfaceModel?.TryResolve(command.Command, out var selection) == true",
|
||||
"ExecuteTradeFilterSelection(",
|
||||
"new AetheriaRuntimeTradeFilterOption(",
|
||||
"RenderRowActionSurface(",
|
||||
"HandleRowActionSurfaceCommand(",
|
||||
"AetheriaEveUnitySurfaceHost.Hide(_rowActionSurfaceDocument)",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeRowActions(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(_rowActionSurfaceModel.State)",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(",
|
||||
"_rowActionSurfaceModel.Document",
|
||||
"_rowActionSurfaceModel?.TryResolve(command.Command, out var selection) == true",
|
||||
"new AetheriaRuntimeTradeRowActionOption(index, action.Label)",
|
||||
"ShowBuyQuantityDialog(",
|
||||
|
|
@ -6020,13 +6020,18 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
"BuildFilterSurfaceCommands(",
|
||||
"ProjectTradeFilterSurfaceState(",
|
||||
"ProjectTradeFilterSurface(",
|
||||
"ComposeTradeFilterSurface(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeFilters(",
|
||||
"_filterSurfaceModel.State",
|
||||
"AddTradeFilterGroup(",
|
||||
"_rowActionSurfaceCommands.TryGetValue(request.Command",
|
||||
"_rowActionSurfaceProjection",
|
||||
"private readonly Dictionary<string, Action> _rowActionSurfaceCommands",
|
||||
"BuildRowActionSurfaceCommands(",
|
||||
"ProjectTradeRowActionSurfaceState(",
|
||||
"ProjectRowActions("
|
||||
"ProjectRowActions(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeRowActions(",
|
||||
"_rowActionSurfaceModel.State"
|
||||
};
|
||||
|
||||
var hits = forbiddenSymbols
|
||||
|
|
@ -6063,11 +6068,12 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
"AetheriaRuntimeTradeRowActionSurfaceModel",
|
||||
"AetheriaRuntimeTradeSurfaceGroup",
|
||||
"AetheriaRuntimeTradeSurfaceOption",
|
||||
"public AetheriaRuntimeSurfaceDocument Document { get; }",
|
||||
"public static string HardpointFilterCommand(",
|
||||
"public static string RowActionCommand(",
|
||||
"public static AetheriaRuntimeTradeFilterSurfaceModel ComposeFilters(",
|
||||
"public static AetheriaRuntimeTradeFilterSurfaceModel BuildFilters(",
|
||||
"public bool TryResolve(string command, out AetheriaRuntimeTradeFilterSelection selection)",
|
||||
"public static AetheriaRuntimeTradeRowActionSurfaceModel ComposeRowActions(",
|
||||
"public static AetheriaRuntimeTradeRowActionSurfaceModel BuildRowActions(",
|
||||
"public bool TryResolve(string command, out AetheriaRuntimeTradeRowActionSelection selection)",
|
||||
"public static AetheriaRuntimeSurfaceDocument BuildFilter(",
|
||||
"public static AetheriaRuntimeSurfaceDocument BuildRowActions(",
|
||||
|
|
@ -6084,6 +6090,15 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
"Shared runtime trade interaction surface builder no longer owns the trade filter/row-action shell contracts: " +
|
||||
string.Join(", ", missingBuilderSymbols));
|
||||
}
|
||||
|
||||
if (tradeInteractionSurfaceBuilder.Contains("public AetheriaRuntimeTradeFilterSurfaceState State { get; }", StringComparison.Ordinal) ||
|
||||
tradeInteractionSurfaceBuilder.Contains("public AetheriaRuntimeTradeRowActionSurfaceState State { get; }", StringComparison.Ordinal) ||
|
||||
tradeInteractionSurfaceBuilder.Contains("public static AetheriaRuntimeTradeFilterSurfaceModel ComposeFilters(", StringComparison.Ordinal) ||
|
||||
tradeInteractionSurfaceBuilder.Contains("public static AetheriaRuntimeTradeRowActionSurfaceModel ComposeRowActions(", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Shared runtime trade interaction builder must return models with finished surface documents; do not re-expose Compose or public State handoffs.");
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireTradeItemDetailsUseEveSurface(string root)
|
||||
|
|
|
|||
|
|
@ -772,13 +772,13 @@ public class TradeMenu : MonoBehaviour
|
|||
|
||||
private void RenderFilterSurface()
|
||||
{
|
||||
_filterSurfaceModel = ComposeTradeFilterSurface();
|
||||
_filterSurfaceModel = BuildTradeFilterSurfaceModel();
|
||||
|
||||
_filterSurfaceDocument = AetheriaEveUnitySurfaceHost.RenderRuntime(
|
||||
transform,
|
||||
_filterSurfaceDocument,
|
||||
"Aetheria Trade Filter Surface",
|
||||
AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(_filterSurfaceModel.State),
|
||||
_filterSurfaceModel.Document,
|
||||
HandleFilterSurfaceCommand,
|
||||
_filterSurfaceChrome,
|
||||
sortingOrder: 1001);
|
||||
|
|
@ -817,7 +817,7 @@ public class TradeMenu : MonoBehaviour
|
|||
AetheriaEveUnitySurfaceHost.Hide(_filterSurfaceDocument);
|
||||
}
|
||||
|
||||
private AetheriaRuntimeTradeFilterSurfaceModel ComposeTradeFilterSurface()
|
||||
private AetheriaRuntimeTradeFilterSurfaceModel BuildTradeFilterSurfaceModel()
|
||||
{
|
||||
var options = new List<AetheriaRuntimeTradeFilterOption>();
|
||||
options.AddRange(((HardpointType[])Enum.GetValues(typeof(HardpointType)))
|
||||
|
|
@ -862,7 +862,7 @@ public class TradeMenu : MonoBehaviour
|
|||
"Maximum Size"));
|
||||
}
|
||||
|
||||
return AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeFilters(
|
||||
return AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilters(
|
||||
BuildFilterSummary(),
|
||||
options,
|
||||
DateTime.UtcNow.ToString("O"));
|
||||
|
|
@ -912,7 +912,7 @@ public class TradeMenu : MonoBehaviour
|
|||
_rowActionCallbacks = actions
|
||||
.Select(action => action.Action)
|
||||
.ToArray();
|
||||
_rowActionSurfaceModel = AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeRowActions(
|
||||
_rowActionSurfaceModel = AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(
|
||||
title,
|
||||
actions.Select((action, index) => new AetheriaRuntimeTradeRowActionOption(index, action.Label)),
|
||||
DateTime.UtcNow.ToString("O"));
|
||||
|
|
@ -921,7 +921,7 @@ public class TradeMenu : MonoBehaviour
|
|||
transform,
|
||||
_rowActionSurfaceDocument,
|
||||
"Aetheria Trade Row Action Surface",
|
||||
AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(_rowActionSurfaceModel.State),
|
||||
_rowActionSurfaceModel.Document,
|
||||
HandleRowActionSurfaceCommand,
|
||||
_rowActionSurfaceChrome,
|
||||
sortingOrder: 1002);
|
||||
|
|
|
|||
|
|
@ -101,17 +101,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public sealed class AetheriaRuntimeTradeFilterSurfaceModel
|
||||
{
|
||||
public AetheriaRuntimeTradeFilterSurfaceModel(
|
||||
AetheriaRuntimeTradeFilterSurfaceState state,
|
||||
AetheriaRuntimeSurfaceDocument document,
|
||||
IReadOnlyDictionary<string, AetheriaRuntimeTradeFilterSelection> selections)
|
||||
{
|
||||
State = state ?? new AetheriaRuntimeTradeFilterSurfaceState(
|
||||
"",
|
||||
Array.Empty<AetheriaRuntimeTradeSurfaceGroup>(),
|
||||
"");
|
||||
Document = document ?? AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(
|
||||
new AetheriaRuntimeTradeFilterSurfaceState(
|
||||
"",
|
||||
Array.Empty<AetheriaRuntimeTradeSurfaceGroup>(),
|
||||
""));
|
||||
Selections = selections ?? new Dictionary<string, AetheriaRuntimeTradeFilterSelection>(StringComparer.Ordinal);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeTradeFilterSurfaceState State { get; }
|
||||
public AetheriaRuntimeSurfaceDocument Document { get; }
|
||||
public IReadOnlyDictionary<string, AetheriaRuntimeTradeFilterSelection> Selections { get; }
|
||||
|
||||
public bool TryResolve(string command, out AetheriaRuntimeTradeFilterSelection selection)
|
||||
|
|
@ -164,17 +165,18 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public sealed class AetheriaRuntimeTradeRowActionSurfaceModel
|
||||
{
|
||||
public AetheriaRuntimeTradeRowActionSurfaceModel(
|
||||
AetheriaRuntimeTradeRowActionSurfaceState state,
|
||||
AetheriaRuntimeSurfaceDocument document,
|
||||
IReadOnlyDictionary<string, AetheriaRuntimeTradeRowActionSelection> selections)
|
||||
{
|
||||
State = state ?? new AetheriaRuntimeTradeRowActionSurfaceState(
|
||||
"",
|
||||
Array.Empty<AetheriaRuntimeTradeSurfaceOption>(),
|
||||
"");
|
||||
Document = document ?? AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(
|
||||
new AetheriaRuntimeTradeRowActionSurfaceState(
|
||||
"",
|
||||
Array.Empty<AetheriaRuntimeTradeSurfaceOption>(),
|
||||
""));
|
||||
Selections = selections ?? new Dictionary<string, AetheriaRuntimeTradeRowActionSelection>(StringComparer.Ordinal);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeTradeRowActionSurfaceState State { get; }
|
||||
public AetheriaRuntimeSurfaceDocument Document { get; }
|
||||
public IReadOnlyDictionary<string, AetheriaRuntimeTradeRowActionSelection> Selections { get; }
|
||||
|
||||
public bool TryResolve(string command, out AetheriaRuntimeTradeRowActionSelection selection)
|
||||
|
|
@ -225,7 +227,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return $"{RowActionSurfaceId}.action_{index}";
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeTradeFilterSurfaceModel ComposeFilters(
|
||||
public static AetheriaRuntimeTradeFilterSurfaceModel BuildFilters(
|
||||
string filterSummary,
|
||||
IEnumerable<AetheriaRuntimeTradeFilterOption> options,
|
||||
string updatedAtUtc)
|
||||
|
|
@ -270,15 +272,15 @@ namespace GameCult.Aetheria.State.Verse
|
|||
.Where(group => group.Options.Count > 0)
|
||||
.ToArray();
|
||||
|
||||
return new AetheriaRuntimeTradeFilterSurfaceModel(
|
||||
new AetheriaRuntimeTradeFilterSurfaceState(
|
||||
filterSummary,
|
||||
groups,
|
||||
updatedAtUtc),
|
||||
selections);
|
||||
var state = new AetheriaRuntimeTradeFilterSurfaceState(
|
||||
filterSummary,
|
||||
groups,
|
||||
updatedAtUtc);
|
||||
|
||||
return new AetheriaRuntimeTradeFilterSurfaceModel(BuildFilter(state), selections);
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeTradeRowActionSurfaceModel ComposeRowActions(
|
||||
public static AetheriaRuntimeTradeRowActionSurfaceModel BuildRowActions(
|
||||
string title,
|
||||
IEnumerable<AetheriaRuntimeTradeRowActionOption> actions,
|
||||
string updatedAtUtc)
|
||||
|
|
@ -302,12 +304,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
selections[command] = new AetheriaRuntimeTradeRowActionSelection(command, action.Index);
|
||||
}
|
||||
|
||||
return new AetheriaRuntimeTradeRowActionSurfaceModel(
|
||||
new AetheriaRuntimeTradeRowActionSurfaceState(
|
||||
title,
|
||||
options,
|
||||
updatedAtUtc),
|
||||
selections);
|
||||
var state = new AetheriaRuntimeTradeRowActionSurfaceState(
|
||||
title,
|
||||
options,
|
||||
updatedAtUtc);
|
||||
|
||||
return new AetheriaRuntimeTradeRowActionSurfaceModel(BuildRowActions(state), selections);
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument BuildFilter(
|
||||
|
|
|
|||
Loading…
Reference in a new issue