Move main menu projection into runtime

This commit is contained in:
Meta Vens 2026-06-21 21:52:46 +01:00
commit f049b329b5
3 changed files with 145 additions and 94 deletions

View file

@ -2976,8 +2976,9 @@ static void RequireMainMenuSettingsCommands(string root)
var requiredMainMenuSymbols = new[]
{
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(ProjectPlayerSettingsSurfaceState())",
"ProjectPlayerSettingsSurfaceState()",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectPlayerSettings(",
"LatestPlayerSettings(CurrentStateBoot())",
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
"AetheriaRuntimeMainMenuCommandKind.PlayerSettingsCommand",
"SendKnownAetheriaEveCommand(request, \"player-settings\")"
@ -3002,6 +3003,8 @@ static void RequireMainMenuSettingsCommands(string root)
"TryQueueAetheriaEveCommand(",
"AetheriaRuntimeEveCommandLog.QueueCommand(",
"BuildPlayerSettingsSurfaceDefinition()",
"ProjectPlayerSettingsSurfaceState(",
"new AetheriaRuntimePlayerSettingsSurfaceState(",
"ResolveMenuSurfaceDocument(",
"new EveUiToolkitSurfaceLowerer",
"host.AddComponent<UIDocument>",
@ -3067,9 +3070,12 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
{
"RenderMenuSurface(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(ProjectPlayerSettingsSurfaceState())",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(ProjectVerseSettingsSurfaceState())",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectPlayerSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectVerseSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(",
"HandleSettingsSurfaceCommand(",
"HandleVerseSettingsSurfaceCommand(",
"HandleInputSettingsSurfaceCommand(",
@ -3080,9 +3086,7 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
"AetheriaRuntimeMainMenuCommandKind.BackToMain",
"AetheriaRuntimeMainMenuCommandKind.BackToSettings",
"AetheriaRuntimeMainMenuCommandKind.OpenRuntimeInputScreen",
"ProjectPlayerSettingsSurfaceState(",
"ProjectVerseSettingsSurfaceState(",
"ProjectMainMenuSurfaceState(",
"LatestPlayerSettings(",
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
"AetheriaEveUnitySurfaceHost.Hide(_menuSurfaceDocument)"
};
@ -3122,6 +3126,12 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
"TrySendVerseHostCommand(request.Command)",
"CommandKindForSurface(request)",
"AetheriaRuntimeClientTargetCommands.IsKnown(request.Command",
"ProjectPlayerSettingsSurfaceState(",
"ProjectVerseSettingsSurfaceState(",
"ProjectMainMenuSurfaceState(",
"new AetheriaRuntimePlayerSettingsSurfaceState(",
"new AetheriaRuntimeClientTargetSurfaceState(",
"new AetheriaRuntimeMainMenuSurfaceState(",
"_nextMenu.panel.Title.text = \"settings\"",
"_nextMenu.panel.Title.text = TitleSubtitle(\"input\", \"settings\")",
"_nextMenu.panel.Title.text = TitleSubtitle(\"audio\", \"settings\")"
@ -3146,6 +3156,9 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
"BuildInputSettings(",
"BuildPlayerSettingsShell(",
"BuildVerseSettingsShell(",
"ProjectRoot(",
"ProjectPlayerSettings(",
"ProjectVerseSettings(",
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(state, version)",
"AetheriaRuntimeClientTargetSurfaceBuilder.Build(state, version)",
"WithBackAction(",
@ -3193,7 +3206,7 @@ static void RequireMainMenuRootUsesEveSurface(string root)
var requiredSymbols = new[]
{
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot(",
"ProjectMainMenuSurfaceState(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(",
"AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
"AetheriaRuntimeMainMenuCommandKind.ContinueRun",
"AetheriaRuntimeMainMenuCommandKind.NewGame",
@ -3202,6 +3215,7 @@ static void RequireMainMenuRootUsesEveSurface(string root)
"HandleMainSurfaceCommand(",
"LatestDaemonFrame(stateBoot)",
"LatestVerseHostSettings(stateBoot)",
"LatestPlayerSettings(stateBoot)",
"HideMenuSurface();"
};
@ -3471,7 +3485,7 @@ static void RequireMainMenuInputSettingsDelegateToRuntimeScreen(string root)
"CanOpenRuntimeInputScreen()",
"TryOpenRuntimeInputScreen()",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings(",
"ProjectMainMenuSurfaceState(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(",
"ActionGameManager.Instance.ShowInputScreenFromMenu();"
};
@ -5992,6 +6006,21 @@ static void RequireClientTargetBootAuthority(string root)
"CurrentStateBoot()",
"LatestDaemonFrame(AetheriaRuntimeStateBootReport stateBoot)",
"LatestVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)",
"AetheriaState.At(ActionGameManager.GameDataDirectory)",
".ClientTarget",
"RequestClientTargetCommand(request)",
"AetheriaRuntimeClientTargetSurfaceCommands.TryRequest(",
"LatestPlayerSettings(AetheriaRuntimeStateBootReport stateBoot)",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectVerseSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings("
};
var requiredMainMenuBuilderSymbols = new[]
{
"AetheriaRuntimeMainMenuSurfaceState",
"ProjectVerseSettings(",
"stateBoot.FailureMessage",
"stateBoot.DiscoveryEndpoints",
"stateBoot.DiscoveredVerses",
@ -6000,18 +6029,6 @@ static void RequireClientTargetBootAuthority(string root)
"stateBoot.ReplicaStateFilePath",
"stateBoot.LastReplicaSyncAtUtc",
"stateBoot.LastReplicaSyncError",
"AetheriaState.At(ActionGameManager.GameDataDirectory)",
".ClientTarget",
"RequestClientTargetCommand(request)",
"AetheriaRuntimeClientTargetSurfaceCommands.TryRequest(",
"ProjectMainMenuSurfaceState(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildSettings(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings("
};
var requiredMainMenuBuilderSymbols = new[]
{
"AetheriaRuntimeMainMenuSurfaceState",
"\"Client Target\"",
"\"Transport\"",
"\"Target Source\""
@ -6454,8 +6471,8 @@ static void RequireVerseSettingsShellAndBridge(string root)
"AetheriaRuntimeMainMenuCommandKind.ShowVerseSettings",
"ShowVerseSettingsSurface()",
"HandleVerseSettingsSurfaceCommand(EveSurfaceCommandRequest request)",
"ProjectVerseSettingsSurfaceState()",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(ProjectVerseSettingsSurfaceState())",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectVerseSettings(",
"AetheriaRuntimeMainMenuSurfaceCommands.TryRead(request, out var command)",
"AetheriaRuntimeMainMenuCommandKind.ClientTargetCommand",
"AetheriaRuntimeMainMenuCommandKind.VerseHostCommand",
@ -8103,7 +8120,7 @@ static void RequireMainMenuVerseHostProjection(string root)
{
"LatestVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)",
"AetheriaRuntimeStateReader.ReadVerseHostSettings(stateBoot.StateFilePath)",
"ProjectMainMenuSurfaceState(",
"AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(",
"AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot("
};
var requiredBuilderSymbols = new[]

View file

@ -1,5 +1,4 @@
using System;
using System.Linq;
using GameCult.Aetheria.EveRuntime;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.Surface;
@ -49,14 +48,17 @@ public class MainMenu : MonoBehaviour
var stateBoot = CurrentStateBoot();
var frame = LatestDaemonFrame(stateBoot);
var verseHost = LatestVerseHostSettings(stateBoot);
var playerSettings = LatestPlayerSettings(stateBoot);
RenderMenuSurface(
AetheriaRuntimeMainMenuSurfaceBuilder.BuildRoot(
ProjectMainMenuSurfaceState(
AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(
stateBoot,
frame,
verseHost,
playerSettings,
CanOpenRuntimeInputScreen(),
InGame)),
InGame,
DateTime.UtcNow.ToString("O"))),
HandleMainSurfaceCommand);
}
@ -159,6 +161,22 @@ public class MainMenu : MonoBehaviour
return frame;
}
private static AetheriaRuntimePlayerSettingsSnapshot LatestPlayerSettings(AetheriaRuntimeStateBootReport stateBoot)
{
if (!stateBoot.SupportsLocalStateFileRead || !stateBoot.StateFileExists)
return null;
try
{
return AetheriaRuntimeStateReader.ReadPlayerSettings(stateBoot.StateFilePath);
}
catch (Exception ex)
{
Debug.LogError($"Failed to read typed Aetheria player settings for the main menu: {ex}");
return null;
}
}
private static AetheriaRuntimeVerseHostSettingsSnapshot LatestVerseHostSettings(AetheriaRuntimeStateBootReport stateBoot)
{
if (!stateBoot.SupportsLocalStateFileRead || !stateBoot.StateFileExists)
@ -192,28 +210,39 @@ public class MainMenu : MonoBehaviour
private void ShowInputSettings()
{
var stateBoot = CurrentStateBoot();
RenderMenuSurface(
AetheriaRuntimeMainMenuSurfaceBuilder.BuildInputSettings(
ProjectMainMenuSurfaceState(
CurrentStateBoot(),
AetheriaRuntimeMainMenuSurfaceBuilder.ProjectRoot(
stateBoot,
null,
null,
LatestPlayerSettings(stateBoot),
CanOpenRuntimeInputScreen(),
InGame)),
InGame,
DateTime.UtcNow.ToString("O"))),
HandleInputSettingsSurfaceCommand);
}
private void ShowPlayerSettingsSurface()
{
RenderMenuSurface(
AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(ProjectPlayerSettingsSurfaceState()),
AetheriaRuntimeMainMenuSurfaceBuilder.BuildPlayerSettingsShell(
AetheriaRuntimeMainMenuSurfaceBuilder.ProjectPlayerSettings(
LatestPlayerSettings(CurrentStateBoot()),
DateTime.UtcNow.ToString("O"))),
HandlePlayerSettingsSurfaceCommand);
}
private void ShowVerseSettingsSurface()
{
var stateBoot = CurrentStateBoot();
RenderMenuSurface(
AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(ProjectVerseSettingsSurfaceState()),
AetheriaRuntimeMainMenuSurfaceBuilder.BuildVerseSettingsShell(
AetheriaRuntimeMainMenuSurfaceBuilder.ProjectVerseSettings(
stateBoot,
LatestVerseHostSettings(stateBoot),
DateTime.UtcNow.ToString("O"))),
HandleVerseSettingsSurfaceCommand);
}
@ -342,71 +371,6 @@ public class MainMenu : MonoBehaviour
AetheriaEveUnitySurfaceHost.Hide(_menuSurfaceDocument);
}
private static AetheriaRuntimePlayerSettingsSurfaceState ProjectPlayerSettingsSurfaceState()
{
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 AetheriaRuntimeClientTargetSurfaceState ProjectVerseSettingsSurfaceState()
{
var stateBoot = CurrentStateBoot();
var verseHost = LatestVerseHostSettings(stateBoot);
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(
AetheriaRuntimeStateBootReport stateBoot,
AetheriaRuntimeDaemonFrameDocument daemonFrame,
AetheriaRuntimeVerseHostSettingsSnapshot verseHost,
bool canOpenRuntimeInputScreen,
bool inGame)
{
return new AetheriaRuntimeMainMenuSurfaceState(
stateBoot.TargetLabel,
stateBoot.TargetKind,
stateBoot.TargetSource,
verseHost?.Title ?? stateBoot.Title,
verseHost?.VerseId ?? stateBoot.VerseId,
verseHost?.Visibility ?? "unknown",
verseHost?.CultMeshAddress ?? stateBoot.CultMeshAddress,
inGame,
daemonFrame != null,
daemonFrame?.Run?.RunId ?? "",
daemonFrame?.FrameId ?? -1,
ActionGameManager.RuntimePlayerSettings.InputSettings.InputActionMap.Count,
ActionGameManager.RuntimePlayerSettings.InputSettings.ActionBarInputs.Count,
canOpenRuntimeInputScreen,
DateTime.UtcNow.ToString("O"));
}
private bool CanOpenRuntimeInputScreen()
{
return InGame &&

View file

@ -90,6 +90,76 @@ namespace GameCult.Aetheria.State.Verse
public static class AetheriaRuntimeMainMenuSurfaceBuilder
{
public static AetheriaRuntimeMainMenuSurfaceState ProjectRoot(
AetheriaRuntimeStateBootReport stateBoot,
AetheriaRuntimeDaemonFrameDocument daemonFrame,
AetheriaRuntimeVerseHostSettingsSnapshot verseHost,
AetheriaRuntimePlayerSettingsSnapshot playerSettings,
bool canOpenRuntimeInputScreen,
bool inGame,
string updatedAtUtc)
{
return new AetheriaRuntimeMainMenuSurfaceState(
stateBoot.TargetLabel,
stateBoot.TargetKind,
stateBoot.TargetSource,
verseHost?.Title ?? stateBoot.Title,
verseHost?.VerseId ?? stateBoot.VerseId,
verseHost?.Visibility ?? "unknown",
verseHost?.CultMeshAddress ?? stateBoot.CultMeshAddress,
inGame,
daemonFrame != null,
daemonFrame?.Run?.RunId ?? "",
daemonFrame?.FrameId ?? -1,
playerSettings?.BindingOverrides?.Count ?? 0,
playerSettings?.ActionBarInputs?.Count ?? 0,
canOpenRuntimeInputScreen,
updatedAtUtc);
}
public static AetheriaRuntimePlayerSettingsSurfaceState ProjectPlayerSettings(
AetheriaRuntimePlayerSettingsSnapshot playerSettings,
string updatedAtUtc)
{
return new AetheriaRuntimePlayerSettingsSurfaceState(
playerSettings?.PlayerName ?? "",
playerSettings?.TutorialPassed ?? false,
"",
playerSettings?.TemperatureUnit ?? "",
Math.Max(0, playerSettings?.SignificantDigits ?? 0),
playerSettings?.NebulaQuality ?? "",
playerSettings?.ShowAsteroidsInMinimap ?? false,
updatedAtUtc);
}
public static AetheriaRuntimeClientTargetSurfaceState ProjectVerseSettings(
AetheriaRuntimeStateBootReport stateBoot,
AetheriaRuntimeVerseHostSettingsSnapshot verseHost,
string updatedAtUtc)
{
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,
updatedAtUtc);
}
public static AetheriaRuntimeSurfaceDocument BuildRoot(
AetheriaRuntimeMainMenuSurfaceState state,
long version = 1)