Rename trade interaction surface models
This commit is contained in:
parent
14cbc92677
commit
ae9ddf43bd
3 changed files with 40 additions and 34 deletions
|
|
@ -5808,22 +5808,22 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
var requiredSymbols = new[]
|
||||
{
|
||||
"RenderFilterSurface(",
|
||||
"_filterSurfaceProjection = ProjectTradeFilterSurface();",
|
||||
"_filterSurfaceModel = ComposeTradeFilterSurface();",
|
||||
"HandleFilterSurfaceCommand(",
|
||||
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
|
||||
"AetheriaEveUnitySurfaceHost.Hide(_filterSurfaceDocument)",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(_filterSurfaceProjection.State)",
|
||||
"ProjectTradeFilterSurface(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ProjectFilters(",
|
||||
"_filterSurfaceProjection?.TryResolve(command.Command, out var selection) == true",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(_filterSurfaceModel.State)",
|
||||
"ComposeTradeFilterSurface(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeFilters(",
|
||||
"_filterSurfaceModel?.TryResolve(command.Command, out var selection) == true",
|
||||
"ExecuteTradeFilterSelection(",
|
||||
"new AetheriaRuntimeTradeFilterOption(",
|
||||
"RenderRowActionSurface(",
|
||||
"HandleRowActionSurfaceCommand(",
|
||||
"AetheriaEveUnitySurfaceHost.Hide(_rowActionSurfaceDocument)",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ProjectRowActions(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(_rowActionSurfaceProjection.State)",
|
||||
"_rowActionSurfaceProjection?.TryResolve(command.Command, out var selection) == true",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeRowActions(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(_rowActionSurfaceModel.State)",
|
||||
"_rowActionSurfaceModel?.TryResolve(command.Command, out var selection) == true",
|
||||
"new AetheriaRuntimeTradeRowActionOption(index, action.Label)",
|
||||
"ShowBuyQuantityDialog(",
|
||||
"AetheriaRuntimeTradeInteractionSurfaceCommands.TryReadFilter(request, out var command)",
|
||||
|
|
@ -5865,14 +5865,18 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
"string.Equals(request.Command, AetheriaRuntimeTradeInteractionSurfaceBuilder.CloseFilter",
|
||||
"string.Equals(request.Command, AetheriaRuntimeTradeInteractionSurfaceBuilder.CloseRowAction",
|
||||
"_filterSurfaceCommands.TryGetValue(request.Command",
|
||||
"_filterSurfaceProjection",
|
||||
"private readonly Dictionary<string, Action> _filterSurfaceCommands",
|
||||
"BuildFilterSurfaceCommands(",
|
||||
"ProjectTradeFilterSurfaceState(",
|
||||
"ProjectTradeFilterSurface(",
|
||||
"AddTradeFilterGroup(",
|
||||
"_rowActionSurfaceCommands.TryGetValue(request.Command",
|
||||
"_rowActionSurfaceProjection",
|
||||
"private readonly Dictionary<string, Action> _rowActionSurfaceCommands",
|
||||
"BuildRowActionSurfaceCommands(",
|
||||
"ProjectTradeRowActionSurfaceState("
|
||||
"ProjectTradeRowActionSurfaceState(",
|
||||
"ProjectRowActions("
|
||||
};
|
||||
|
||||
var hits = forbiddenSymbols
|
||||
|
|
@ -5902,22 +5906,24 @@ static void RequireTradeFilterAndRowActionsUseEveSurface(string root)
|
|||
"AetheriaRuntimeTradeFilterOption",
|
||||
"AetheriaRuntimeTradeFilterSelectionKind",
|
||||
"AetheriaRuntimeTradeFilterSelection",
|
||||
"AetheriaRuntimeTradeFilterSurfaceProjection",
|
||||
"AetheriaRuntimeTradeFilterSurfaceModel",
|
||||
"AetheriaRuntimeTradeRowActionSurfaceState",
|
||||
"AetheriaRuntimeTradeRowActionOption",
|
||||
"AetheriaRuntimeTradeRowActionSelection",
|
||||
"AetheriaRuntimeTradeRowActionSurfaceProjection",
|
||||
"AetheriaRuntimeTradeRowActionSurfaceModel",
|
||||
"AetheriaRuntimeTradeSurfaceGroup",
|
||||
"AetheriaRuntimeTradeSurfaceOption",
|
||||
"public static string HardpointFilterCommand(",
|
||||
"public static string RowActionCommand(",
|
||||
"public static AetheriaRuntimeTradeFilterSurfaceProjection ProjectFilters(",
|
||||
"public static AetheriaRuntimeTradeFilterSurfaceModel ComposeFilters(",
|
||||
"public bool TryResolve(string command, out AetheriaRuntimeTradeFilterSelection selection)",
|
||||
"public static AetheriaRuntimeTradeRowActionSurfaceProjection ProjectRowActions(",
|
||||
"public static AetheriaRuntimeTradeRowActionSurfaceModel ComposeRowActions(",
|
||||
"public bool TryResolve(string command, out AetheriaRuntimeTradeRowActionSelection selection)",
|
||||
"public static AetheriaRuntimeSurfaceDocument BuildFilter(",
|
||||
"public static AetheriaRuntimeSurfaceDocument BuildRowActions(",
|
||||
"providerKind: \"trade.menu\""
|
||||
"providerKind: \"trade.menu\"",
|
||||
"The observing client lists available trade filters; the shared runtime surface owns the filter selector contract.",
|
||||
"The observing client lists available row actions; the shared runtime surface owns the row action contract."
|
||||
};
|
||||
var missingBuilderSymbols = requiredBuilderSymbols
|
||||
.Where(symbol => !tradeInteractionSurfaceBuilder.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ public class TradeMenu : MonoBehaviour
|
|||
private AetheriaRuntimeStationCargoTargetRow[] _cargoSelectorStationRefitTargets =
|
||||
Array.Empty<AetheriaRuntimeStationCargoTargetRow>();
|
||||
private AetheriaRuntimeStationRefitDocument _stationRefit;
|
||||
private AetheriaRuntimeTradeFilterSurfaceProjection _filterSurfaceProjection;
|
||||
private AetheriaRuntimeTradeFilterSurfaceModel _filterSurfaceModel;
|
||||
private Action[] _rowActionCallbacks = Array.Empty<Action>();
|
||||
private AetheriaRuntimeTradeRowActionSurfaceProjection _rowActionSurfaceProjection;
|
||||
private AetheriaRuntimeTradeRowActionSurfaceModel _rowActionSurfaceModel;
|
||||
|
||||
public EquippedCargoBay Inventory { get; set; }
|
||||
|
||||
|
|
@ -766,13 +766,13 @@ public class TradeMenu : MonoBehaviour
|
|||
|
||||
private void RenderFilterSurface()
|
||||
{
|
||||
_filterSurfaceProjection = ProjectTradeFilterSurface();
|
||||
_filterSurfaceModel = ComposeTradeFilterSurface();
|
||||
|
||||
_filterSurfaceDocument = AetheriaEveUnitySurfaceHost.RenderRuntime(
|
||||
transform,
|
||||
_filterSurfaceDocument,
|
||||
"Aetheria Trade Filter Surface",
|
||||
AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(_filterSurfaceProjection.State),
|
||||
AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildFilter(_filterSurfaceModel.State),
|
||||
HandleFilterSurfaceCommand,
|
||||
_filterSurfaceChrome,
|
||||
sortingOrder: 1001);
|
||||
|
|
@ -793,7 +793,7 @@ public class TradeMenu : MonoBehaviour
|
|||
}
|
||||
|
||||
if (command.Kind == AetheriaRuntimeTradeInteractionCommandKind.Select &&
|
||||
_filterSurfaceProjection?.TryResolve(command.Command, out var selection) == true)
|
||||
_filterSurfaceModel?.TryResolve(command.Command, out var selection) == true)
|
||||
{
|
||||
ExecuteTradeFilterSelection(selection);
|
||||
HideFilterSurface();
|
||||
|
|
@ -811,7 +811,7 @@ public class TradeMenu : MonoBehaviour
|
|||
AetheriaEveUnitySurfaceHost.Hide(_filterSurfaceDocument);
|
||||
}
|
||||
|
||||
private AetheriaRuntimeTradeFilterSurfaceProjection ProjectTradeFilterSurface()
|
||||
private AetheriaRuntimeTradeFilterSurfaceModel ComposeTradeFilterSurface()
|
||||
{
|
||||
var options = new List<AetheriaRuntimeTradeFilterOption>();
|
||||
options.AddRange(((HardpointType[])Enum.GetValues(typeof(HardpointType)))
|
||||
|
|
@ -856,7 +856,7 @@ public class TradeMenu : MonoBehaviour
|
|||
"Maximum Size"));
|
||||
}
|
||||
|
||||
return AetheriaRuntimeTradeInteractionSurfaceBuilder.ProjectFilters(
|
||||
return AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeFilters(
|
||||
BuildFilterSummary(),
|
||||
options,
|
||||
DateTime.UtcNow.ToString("O"));
|
||||
|
|
@ -906,7 +906,7 @@ public class TradeMenu : MonoBehaviour
|
|||
_rowActionCallbacks = actions
|
||||
.Select(action => action.Action)
|
||||
.ToArray();
|
||||
_rowActionSurfaceProjection = AetheriaRuntimeTradeInteractionSurfaceBuilder.ProjectRowActions(
|
||||
_rowActionSurfaceModel = AetheriaRuntimeTradeInteractionSurfaceBuilder.ComposeRowActions(
|
||||
title,
|
||||
actions.Select((action, index) => new AetheriaRuntimeTradeRowActionOption(index, action.Label)),
|
||||
DateTime.UtcNow.ToString("O"));
|
||||
|
|
@ -915,7 +915,7 @@ public class TradeMenu : MonoBehaviour
|
|||
transform,
|
||||
_rowActionSurfaceDocument,
|
||||
"Aetheria Trade Row Action Surface",
|
||||
AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(_rowActionSurfaceProjection.State),
|
||||
AetheriaRuntimeTradeInteractionSurfaceBuilder.BuildRowActions(_rowActionSurfaceModel.State),
|
||||
HandleRowActionSurfaceCommand,
|
||||
_rowActionSurfaceChrome,
|
||||
sortingOrder: 1002);
|
||||
|
|
@ -936,7 +936,7 @@ public class TradeMenu : MonoBehaviour
|
|||
}
|
||||
|
||||
if (command.Kind == AetheriaRuntimeTradeInteractionCommandKind.Select &&
|
||||
_rowActionSurfaceProjection?.TryResolve(command.Command, out var selection) == true &&
|
||||
_rowActionSurfaceModel?.TryResolve(command.Command, out var selection) == true &&
|
||||
selection.Index >= 0 &&
|
||||
selection.Index < _rowActionCallbacks.Length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public string Token { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeTradeFilterSurfaceProjection
|
||||
public sealed class AetheriaRuntimeTradeFilterSurfaceModel
|
||||
{
|
||||
public AetheriaRuntimeTradeFilterSurfaceProjection(
|
||||
public AetheriaRuntimeTradeFilterSurfaceModel(
|
||||
AetheriaRuntimeTradeFilterSurfaceState state,
|
||||
IReadOnlyDictionary<string, AetheriaRuntimeTradeFilterSelection> selections)
|
||||
{
|
||||
|
|
@ -161,9 +161,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public int Index { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeTradeRowActionSurfaceProjection
|
||||
public sealed class AetheriaRuntimeTradeRowActionSurfaceModel
|
||||
{
|
||||
public AetheriaRuntimeTradeRowActionSurfaceProjection(
|
||||
public AetheriaRuntimeTradeRowActionSurfaceModel(
|
||||
AetheriaRuntimeTradeRowActionSurfaceState state,
|
||||
IReadOnlyDictionary<string, AetheriaRuntimeTradeRowActionSelection> selections)
|
||||
{
|
||||
|
|
@ -225,7 +225,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return $"{RowActionSurfaceId}.action_{index}";
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeTradeFilterSurfaceProjection ProjectFilters(
|
||||
public static AetheriaRuntimeTradeFilterSurfaceModel ComposeFilters(
|
||||
string filterSummary,
|
||||
IEnumerable<AetheriaRuntimeTradeFilterOption> options,
|
||||
string updatedAtUtc)
|
||||
|
|
@ -270,7 +270,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
.Where(group => group.Options.Count > 0)
|
||||
.ToArray();
|
||||
|
||||
return new AetheriaRuntimeTradeFilterSurfaceProjection(
|
||||
return new AetheriaRuntimeTradeFilterSurfaceModel(
|
||||
new AetheriaRuntimeTradeFilterSurfaceState(
|
||||
filterSummary,
|
||||
groups,
|
||||
|
|
@ -278,7 +278,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
selections);
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeTradeRowActionSurfaceProjection ProjectRowActions(
|
||||
public static AetheriaRuntimeTradeRowActionSurfaceModel ComposeRowActions(
|
||||
string title,
|
||||
IEnumerable<AetheriaRuntimeTradeRowActionOption> actions,
|
||||
string updatedAtUtc)
|
||||
|
|
@ -302,7 +302,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
selections[command] = new AetheriaRuntimeTradeRowActionSelection(command, action.Index);
|
||||
}
|
||||
|
||||
return new AetheriaRuntimeTradeRowActionSurfaceProjection(
|
||||
return new AetheriaRuntimeTradeRowActionSurfaceModel(
|
||||
new AetheriaRuntimeTradeRowActionSurfaceState(
|
||||
title,
|
||||
options,
|
||||
|
|
@ -326,7 +326,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
"Trade Filters",
|
||||
Text(
|
||||
$"{FilterSurfaceId}.note",
|
||||
"The observing client projects available trade filters; the shared runtime surface owns the filter selector contract."),
|
||||
"The observing client lists available trade filters; the shared runtime surface owns the filter selector contract."),
|
||||
Text($"{FilterSurfaceId}.active", state.FilterSummary))
|
||||
};
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Text($"{RowActionSurfaceId}.title", state.Title),
|
||||
Text(
|
||||
$"{RowActionSurfaceId}.note",
|
||||
"The observing client projects available row actions; the shared runtime surface owns the row action contract."),
|
||||
"The observing client lists available row actions; the shared runtime surface owns the row action contract."),
|
||||
ButtonColumn(
|
||||
$"{RowActionSurfaceId}.options",
|
||||
state.Actions
|
||||
|
|
|
|||
Loading…
Reference in a new issue