Move main menu settings shell wrapping to runtime
This commit is contained in:
parent
fb4b32e1d8
commit
56aa82cdd9
3 changed files with 72 additions and 51 deletions
|
|
@ -2976,7 +2976,8 @@ static void RequireMainMenuSettingsCommands(string root)
|
|||
|
||||
var requiredMainMenuSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(ProjectPlayerSettingsSurfaceState())",
|
||||
"ProjectPlayerSettingsSurfaceState()",
|
||||
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
|
||||
"AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand",
|
||||
"SendKnownAetheriaEveCommand(request, \"player-settings\")"
|
||||
|
|
@ -3000,6 +3001,7 @@ static void RequireMainMenuSettingsCommands(string root)
|
|||
"TryQueuePlayerSettingsCommand(",
|
||||
"TryQueueAetheriaEveCommand(",
|
||||
"AetheriaRuntimeEveCommandLog.QueueCommand(",
|
||||
"BuildPlayerSettingsSurfaceDefinition()",
|
||||
"ResolveMenuSurfaceDocument(",
|
||||
"new EveUiToolkitSurfaceLowerer",
|
||||
"host.AddComponent<UIDocument>",
|
||||
|
|
@ -3065,12 +3067,12 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
|
|||
{
|
||||
"RenderMenuSurface(",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildSettings(",
|
||||
"BuildVerseSettingsSurfaceDefinition()",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(ProjectPlayerSettingsSurfaceState())",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(ProjectVerseSettingsSurfaceState())",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings(",
|
||||
"HandleSettingsSurfaceCommand(",
|
||||
"HandleVerseSettingsSurfaceCommand(",
|
||||
"HandleInputSettingsSurfaceCommand(",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.WithBackAction(",
|
||||
"AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
|
||||
"AetheriaRuntimeMainMenuCommandKind.ShowPlayerSettings",
|
||||
"AetheriaRuntimeMainMenuCommandKind.ShowVerseSettings",
|
||||
|
|
@ -3078,7 +3080,8 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
|
|||
"AetheriaRuntimeMainMenuCommandKind.BackToMain",
|
||||
"AetheriaRuntimeMainMenuCommandKind.BackToSettings",
|
||||
"AetheriaRuntimeMainMenuCommandKind.OpenRuntimeInputScreen",
|
||||
"AetheriaRuntimeMainMenuCommands.BackToSettings",
|
||||
"ProjectPlayerSettingsSurfaceState(",
|
||||
"ProjectVerseSettingsSurfaceState(",
|
||||
"ProjectMainMenuSurfaceState(",
|
||||
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
|
||||
"AetheriaEveUnitySurfaceHost.Hide(_menuSurfaceDocument)"
|
||||
|
|
@ -3099,6 +3102,8 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
|
|||
{
|
||||
"BuildSettingsSurfaceDefinition(",
|
||||
"BuildInputSettingsSurfaceDefinition(",
|
||||
"BuildPlayerSettingsSurfaceDefinition(",
|
||||
"BuildVerseSettingsSurfaceDefinition(",
|
||||
"private static EveSurfaceComponent Button(",
|
||||
"private static EveSurfaceComponent Card(",
|
||||
"_nextMenu.panel.AddButton(\"Player Settings\"",
|
||||
|
|
@ -3139,7 +3144,12 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
|
|||
"public static class AetheriaRuntimeMainMenuCommands",
|
||||
"BuildSettings(",
|
||||
"BuildInputSettings(",
|
||||
"BuildPlayerSettingsShell(",
|
||||
"BuildVerseSettingsShell(",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(state, version)",
|
||||
"AetheriaRuntimeClientTargetSurfaceBuilder.Build(state, version)",
|
||||
"WithBackAction(",
|
||||
"AetheriaRuntimeMainMenuCommands.BackToSettings",
|
||||
"public enum AetheriaRuntimeMainMenuCommandKind",
|
||||
"public readonly struct AetheriaRuntimeMainMenuCommand",
|
||||
"public static class AetheriaRuntimeMainMenuSurfaceCommands",
|
||||
|
|
@ -6350,12 +6360,11 @@ static void RequireVerseSettingsShellAndBridge(string root)
|
|||
|
||||
var requiredMainMenuSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimeMainMenuCommands.VerseSettingsShellSurfaceId",
|
||||
"AetheriaRuntimeMainMenuCommandKind.ShowVerseSettings",
|
||||
"ShowVerseSettingsSurface()",
|
||||
"HandleVerseSettingsSurfaceCommand(EveSurfaceCommandRequest request)",
|
||||
"BuildVerseSettingsSurfaceDefinition()",
|
||||
"AetheriaRuntimeClientTargetSurfaceBuilder.Build(",
|
||||
"ProjectVerseSettingsSurfaceState()",
|
||||
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(ProjectVerseSettingsSurfaceState())",
|
||||
"AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
|
||||
"AetheriaRuntimeMainMenuCommandKind.ClientTargetCommand",
|
||||
"AetheriaRuntimeMainMenuCommandKind.VerseHostCommand",
|
||||
|
|
|
|||
|
|
@ -206,22 +206,14 @@ public class MainMenu : MonoBehaviour
|
|||
private void ShowPlayerSettingsSurface()
|
||||
{
|
||||
RenderMenuSurface(
|
||||
AetheriaRuntimeMainMenuSurfaceBuilder.WithBackAction(
|
||||
BuildPlayerSettingsSurfaceDefinition(),
|
||||
AetheriaRuntimeMainMenuCommands.PlayerSettingsShellSurfaceId,
|
||||
AetheriaRuntimeMainMenuCommands.BackToSettings,
|
||||
"Back"),
|
||||
AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(ProjectPlayerSettingsSurfaceState()),
|
||||
HandlePlayerSettingsSurfaceCommand);
|
||||
}
|
||||
|
||||
private void ShowVerseSettingsSurface()
|
||||
{
|
||||
RenderMenuSurface(
|
||||
AetheriaRuntimeMainMenuSurfaceBuilder.WithBackAction(
|
||||
BuildVerseSettingsSurfaceDefinition(),
|
||||
AetheriaRuntimeMainMenuCommands.VerseSettingsShellSurfaceId,
|
||||
AetheriaRuntimeMainMenuCommands.BackToSettings,
|
||||
"Back"),
|
||||
AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(ProjectVerseSettingsSurfaceState()),
|
||||
HandleVerseSettingsSurfaceCommand);
|
||||
}
|
||||
|
||||
|
|
@ -350,46 +342,44 @@ public class MainMenu : MonoBehaviour
|
|||
AetheriaEveUnitySurfaceHost.Hide(_menuSurfaceDocument);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceDocument BuildPlayerSettingsSurfaceDefinition()
|
||||
private static AetheriaRuntimePlayerSettingsSurfaceState ProjectPlayerSettingsSurfaceState()
|
||||
{
|
||||
return AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(
|
||||
new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
ActionGameManager.RuntimePlayerSettings.Name,
|
||||
ActionGameManager.RuntimePlayerSettings.TutorialPassed,
|
||||
"",
|
||||
ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit.ToString(),
|
||||
Math.Max(0, ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits),
|
||||
ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality.ToString(),
|
||||
ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap,
|
||||
DateTime.UtcNow.ToString("O")));
|
||||
return new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
ActionGameManager.RuntimePlayerSettings.Name,
|
||||
ActionGameManager.RuntimePlayerSettings.TutorialPassed,
|
||||
"",
|
||||
ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit.ToString(),
|
||||
Math.Max(0, ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits),
|
||||
ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality.ToString(),
|
||||
ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap,
|
||||
DateTime.UtcNow.ToString("O"));
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceDocument BuildVerseSettingsSurfaceDefinition()
|
||||
private static AetheriaRuntimeClientTargetSurfaceState ProjectVerseSettingsSurfaceState()
|
||||
{
|
||||
var stateBoot = CurrentStateBoot();
|
||||
var verseHost = LatestVerseHostSettings(stateBoot);
|
||||
return AetheriaRuntimeClientTargetSurfaceBuilder.Build(
|
||||
new AetheriaRuntimeClientTargetSurfaceState(
|
||||
stateBoot.TargetKind,
|
||||
stateBoot.Title,
|
||||
stateBoot.VerseId,
|
||||
stateBoot.CultMeshAddress,
|
||||
stateBoot.StateFilePath,
|
||||
stateBoot.ReplicaStateFilePath,
|
||||
string.Join(", ", stateBoot.DiscoveryEndpoints ?? Array.Empty<string>()),
|
||||
stateBoot.DiscoveredVerses ?? Array.Empty<AetheriaRuntimeDiscoveredVerse>(),
|
||||
stateBoot.LastDiscoveryAtUtc,
|
||||
stateBoot.LastDiscoveryError,
|
||||
stateBoot.LastReplicaSyncAtUtc,
|
||||
stateBoot.LastReplicaSyncError,
|
||||
stateBoot.TargetSource,
|
||||
stateBoot.SupportsLocalStateFileRead,
|
||||
stateBoot.FailureMessage,
|
||||
verseHost?.Title ?? stateBoot.Title,
|
||||
verseHost?.VerseId ?? stateBoot.VerseId,
|
||||
verseHost?.Visibility ?? "unknown",
|
||||
verseHost?.CultMeshAddress ?? stateBoot.CultMeshAddress,
|
||||
DateTime.UtcNow.ToString("O")));
|
||||
return new AetheriaRuntimeClientTargetSurfaceState(
|
||||
stateBoot.TargetKind,
|
||||
stateBoot.Title,
|
||||
stateBoot.VerseId,
|
||||
stateBoot.CultMeshAddress,
|
||||
stateBoot.StateFilePath,
|
||||
stateBoot.ReplicaStateFilePath,
|
||||
string.Join(", ", stateBoot.DiscoveryEndpoints ?? Array.Empty<string>()),
|
||||
stateBoot.DiscoveredVerses ?? Array.Empty<AetheriaRuntimeDiscoveredVerse>(),
|
||||
stateBoot.LastDiscoveryAtUtc,
|
||||
stateBoot.LastDiscoveryError,
|
||||
stateBoot.LastReplicaSyncAtUtc,
|
||||
stateBoot.LastReplicaSyncError,
|
||||
stateBoot.TargetSource,
|
||||
stateBoot.SupportsLocalStateFileRead,
|
||||
stateBoot.FailureMessage,
|
||||
verseHost?.Title ?? stateBoot.Title,
|
||||
verseHost?.VerseId ?? stateBoot.VerseId,
|
||||
verseHost?.Visibility ?? "unknown",
|
||||
verseHost?.CultMeshAddress ?? stateBoot.CultMeshAddress,
|
||||
DateTime.UtcNow.ToString("O"));
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeMainMenuSurfaceState ProjectMainMenuSurfaceState(
|
||||
|
|
|
|||
|
|
@ -277,6 +277,28 @@ namespace GameCult.Aetheria.State.Verse
|
|||
cardChildren.ToArray()));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument BuildPlayerSettingsShell(
|
||||
AetheriaRuntimePlayerSettingsSurfaceState state,
|
||||
long version = 1)
|
||||
{
|
||||
return WithBackAction(
|
||||
AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(state, version),
|
||||
AetheriaRuntimeMainMenuCommands.PlayerSettingsShellSurfaceId,
|
||||
AetheriaRuntimeMainMenuCommands.BackToSettings,
|
||||
"Back");
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument BuildVerseSettingsShell(
|
||||
AetheriaRuntimeClientTargetSurfaceState state,
|
||||
long version = 1)
|
||||
{
|
||||
return WithBackAction(
|
||||
AetheriaRuntimeClientTargetSurfaceBuilder.Build(state, version),
|
||||
AetheriaRuntimeMainMenuCommands.VerseSettingsShellSurfaceId,
|
||||
AetheriaRuntimeMainMenuCommands.BackToSettings,
|
||||
"Back");
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument WithBackAction(
|
||||
AetheriaRuntimeSurfaceDocument document,
|
||||
string surfaceId,
|
||||
|
|
|
|||
Loading…
Reference in a new issue