Collapse player settings surface state
This commit is contained in:
parent
4def370fd0
commit
99c153ac0d
4 changed files with 64 additions and 87 deletions
|
|
@ -3804,7 +3804,7 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
|
|||
"private static AetheriaRuntimeSurfaceDocument BuildRoot(",
|
||||
"private static AetheriaRuntimeSurfaceDocument BuildInputSettings(",
|
||||
"var verseLabel = VerseLabel(verseTitle, verseId)",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(state, version)",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(playerSettings, updatedAtUtc, version)",
|
||||
"AetheriaRuntimeSurfaceDocument document",
|
||||
"WithBackAction(",
|
||||
"AetheriaRuntimeMainMenuCommands.BackToSettings",
|
||||
|
|
@ -3830,6 +3830,7 @@ static void RequireMainMenuSettingsShellUsesEveSurface(string root)
|
|||
if (mainMenuSurfaceBuilder.Contains("AetheriaRuntimeMainMenuSurfaceState", StringComparison.Ordinal) ||
|
||||
mainMenuSurfaceBuilder.Contains("ComposeRootState(", StringComparison.Ordinal) ||
|
||||
mainMenuSurfaceBuilder.Contains("ComposePlayerSettingsState(", StringComparison.Ordinal) ||
|
||||
mainMenuSurfaceBuilder.Contains("new AetheriaRuntimePlayerSettingsSurfaceState(", StringComparison.Ordinal) ||
|
||||
mainMenuSurfaceBuilder.Contains("public static AetheriaRuntimeMainMenuSurfaceState Project", StringComparison.Ordinal) ||
|
||||
mainMenuSurfaceBuilder.Contains("public static AetheriaRuntimePlayerSettingsSurfaceState Project", StringComparison.Ordinal))
|
||||
{
|
||||
|
|
@ -6960,7 +6961,6 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
{
|
||||
"AetheriaRuntimePlayerSettingsCommands.SurfaceId",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceState",
|
||||
"settings.ActiveRunKey"
|
||||
};
|
||||
|
||||
|
|
@ -6975,6 +6975,13 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
string.Join(", ", missingSurfaceDocumentSymbols));
|
||||
}
|
||||
|
||||
if (surfaceDocuments.Contains("AetheriaRuntimePlayerSettingsSurfaceState", StringComparison.Ordinal) ||
|
||||
surfaceDocuments.Contains("new AetheriaRuntimePlayerSettingsSurfaceState(", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Player settings Eve surface document should pass typed settings directly into the shared builder, not repack them into a shadow surface state.");
|
||||
}
|
||||
|
||||
var bridge = File.Exists(bridgePath)
|
||||
? File.ReadAllText(bridgePath)
|
||||
: throw new InvalidOperationException("Player settings Eve command bridge is missing.");
|
||||
|
|
@ -7040,6 +7047,13 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
throw new InvalidOperationException(
|
||||
"Shared player-settings Eve surface builder no longer owns the portable settings surface contract.");
|
||||
}
|
||||
|
||||
if (surfaceBuilder.Contains("AetheriaRuntimePlayerSettingsSurfaceState", StringComparison.Ordinal) ||
|
||||
surfaceBuilder.Contains("new AetheriaRuntimePlayerSettingsSurfaceState(", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Shared player-settings Eve surface builder should accept typed documents or semantic values directly, not a duplicate SurfaceState DTO.");
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireDaemonHostDoesNotDrainRuntimeCommits(string root)
|
||||
|
|
|
|||
|
|
@ -214,15 +214,14 @@ public static class AetheriaEveSurfaceDocuments
|
|||
: updatedAtUtc;
|
||||
|
||||
var surface = AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(
|
||||
new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
settings.PlayerName,
|
||||
settings.TutorialPassed,
|
||||
settings.ActiveRunKey,
|
||||
gameplay.TemperatureUnit,
|
||||
gameplay.SignificantDigits,
|
||||
graphics.NebulaQuality,
|
||||
graphics.ShowAsteroidsInMinimap,
|
||||
publishedAtUtc),
|
||||
settings.PlayerName,
|
||||
settings.TutorialPassed,
|
||||
settings.ActiveRunKey,
|
||||
gameplay.TemperatureUnit,
|
||||
gameplay.SignificantDigits,
|
||||
graphics.NebulaQuality,
|
||||
graphics.ShowAsteroidsInMinimap,
|
||||
publishedAtUtc,
|
||||
version);
|
||||
|
||||
return new EveSurfaceState
|
||||
|
|
|
|||
|
|
@ -125,17 +125,11 @@ namespace GameCult.Aetheria.State.Verse
|
|||
string updatedAtUtc,
|
||||
long version = 1)
|
||||
{
|
||||
var state = new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
playerSettings?.PlayerName ?? "",
|
||||
playerSettings?.TutorialPassed ?? false,
|
||||
"",
|
||||
playerSettings?.TemperatureUnit ?? "",
|
||||
Math.Max(0, playerSettings?.SignificantDigits ?? 0),
|
||||
playerSettings?.NebulaQuality ?? "",
|
||||
playerSettings?.ShowAsteroidsInMinimap ?? false,
|
||||
updatedAtUtc);
|
||||
|
||||
return BuildPlayerSettingsShell(state, version);
|
||||
return WithBackAction(
|
||||
AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(playerSettings, updatedAtUtc, version),
|
||||
AetheriaRuntimeMainMenuCommands.PlayerSettingsShellSurfaceId,
|
||||
AetheriaRuntimeMainMenuCommands.BackToSettings,
|
||||
"Back");
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceDocument BuildRoot(
|
||||
|
|
@ -337,17 +331,6 @@ 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(
|
||||
AetheriaRuntimeSurfaceDocument document,
|
||||
long version = 1)
|
||||
|
|
|
|||
|
|
@ -266,9 +266,26 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public string Transport => Operation.RouteHint.Description ?? "";
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimePlayerSettingsSurfaceState
|
||||
public static class AetheriaRuntimePlayerSettingsSurfaceBuilder
|
||||
{
|
||||
public AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
public static AetheriaRuntimeSurfaceDocument Build(
|
||||
AetheriaRuntimePlayerSettingsDocument settings,
|
||||
string updatedAtUtc,
|
||||
long version = 1)
|
||||
{
|
||||
return Build(
|
||||
settings?.PlayerName ?? "",
|
||||
settings?.TutorialPassed ?? false,
|
||||
activeRunKey: "",
|
||||
settings?.TemperatureUnit ?? "",
|
||||
Math.Max(0, settings?.SignificantDigits ?? 0),
|
||||
settings?.NebulaQuality ?? "",
|
||||
settings?.ShowAsteroidsInMinimap ?? false,
|
||||
updatedAtUtc,
|
||||
version);
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument Build(
|
||||
string playerName,
|
||||
bool tutorialPassed,
|
||||
string activeRunKey,
|
||||
|
|
@ -276,57 +293,21 @@ namespace GameCult.Aetheria.State.Verse
|
|||
int significantDigits,
|
||||
string nebulaQuality,
|
||||
bool showAsteroidsInMinimap,
|
||||
string updatedAtUtc)
|
||||
{
|
||||
PlayerName = playerName ?? "";
|
||||
TutorialPassed = tutorialPassed;
|
||||
ActiveRunKey = activeRunKey ?? "";
|
||||
TemperatureUnit = temperatureUnit ?? "";
|
||||
SignificantDigits = significantDigits;
|
||||
NebulaQuality = nebulaQuality ?? "";
|
||||
ShowAsteroidsInMinimap = showAsteroidsInMinimap;
|
||||
UpdatedAtUtc = updatedAtUtc ?? "";
|
||||
}
|
||||
|
||||
public string PlayerName { get; }
|
||||
|
||||
public bool TutorialPassed { get; }
|
||||
|
||||
public string ActiveRunKey { get; }
|
||||
|
||||
public string TemperatureUnit { get; }
|
||||
|
||||
public int SignificantDigits { get; }
|
||||
|
||||
public string NebulaQuality { get; }
|
||||
|
||||
public bool ShowAsteroidsInMinimap { get; }
|
||||
|
||||
public string UpdatedAtUtc { get; }
|
||||
}
|
||||
|
||||
public static class AetheriaRuntimePlayerSettingsSurfaceBuilder
|
||||
{
|
||||
public static AetheriaRuntimeSurfaceDocument Build(
|
||||
AetheriaRuntimePlayerSettingsSurfaceState settings,
|
||||
string updatedAtUtc,
|
||||
long version = 1)
|
||||
{
|
||||
settings ??= new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
"",
|
||||
tutorialPassed: false,
|
||||
activeRunKey: "",
|
||||
temperatureUnit: "",
|
||||
significantDigits: 0,
|
||||
nebulaQuality: "",
|
||||
showAsteroidsInMinimap: false,
|
||||
updatedAtUtc: "");
|
||||
|
||||
playerName ??= "";
|
||||
activeRunKey ??= "";
|
||||
temperatureUnit ??= "";
|
||||
nebulaQuality ??= "";
|
||||
updatedAtUtc ??= "";
|
||||
significantDigits = Math.Max(0, significantDigits);
|
||||
return new AetheriaRuntimeSurfaceDocument(
|
||||
providerId: "aetheria",
|
||||
providerKind: "game.runtime",
|
||||
title: "Aetheria Player Settings",
|
||||
version: version,
|
||||
updatedAtUtc: settings.UpdatedAtUtc,
|
||||
updatedAtUtc: updatedAtUtc,
|
||||
surface: new AetheriaRuntimeSurfaceTree(
|
||||
AetheriaRuntimePlayerSettingsCommands.SurfaceId,
|
||||
Node(
|
||||
|
|
@ -340,12 +321,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
TextInput(
|
||||
"playerSettings.summary.playerName",
|
||||
"Name",
|
||||
settings.PlayerName,
|
||||
playerName,
|
||||
AetheriaRuntimePlayerSettingsCommands.SetPlayerName),
|
||||
Row(
|
||||
"playerSettings.summary.values",
|
||||
("tutorialPassed", settings.TutorialPassed ? "Yes" : "No"),
|
||||
("activeRun", settings.ActiveRunKey)),
|
||||
("tutorialPassed", tutorialPassed ? "Yes" : "No"),
|
||||
("activeRun", activeRunKey)),
|
||||
Text(
|
||||
"playerSettings.summary.note",
|
||||
"Input remapping lowers through the runtime Eve input screen and sends typed input-setting requests.")),
|
||||
|
|
@ -353,7 +334,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
"aetheria.playerSettings.gameplay",
|
||||
"card",
|
||||
new[] { ("title", "Gameplay") },
|
||||
Metric("playerSettings.gameplay.temperatureUnit", "Temperature Unit", settings.TemperatureUnit),
|
||||
Metric("playerSettings.gameplay.temperatureUnit", "Temperature Unit", temperatureUnit),
|
||||
ButtonRow(
|
||||
"playerSettings.gameplay.temperatureUnit.buttons",
|
||||
Button(
|
||||
|
|
@ -363,7 +344,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Metric(
|
||||
"playerSettings.gameplay.significantDigits",
|
||||
"Significant Digits",
|
||||
settings.SignificantDigits.ToString()),
|
||||
significantDigits.ToString()),
|
||||
ButtonRow(
|
||||
"playerSettings.gameplay.significantDigits.buttons",
|
||||
Button(
|
||||
|
|
@ -378,7 +359,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
"aetheria.playerSettings.graphics",
|
||||
"card",
|
||||
new[] { ("title", "Graphics") },
|
||||
Metric("playerSettings.graphics.nebulaQuality", "Nebula Quality", settings.NebulaQuality),
|
||||
Metric("playerSettings.graphics.nebulaQuality", "Nebula Quality", nebulaQuality),
|
||||
ButtonRow(
|
||||
"playerSettings.graphics.nebulaQuality.buttons",
|
||||
Button(
|
||||
|
|
@ -388,12 +369,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Metric(
|
||||
"playerSettings.graphics.showAsteroids",
|
||||
"Show Asteroids In Minimap",
|
||||
settings.ShowAsteroidsInMinimap ? "Enabled" : "Disabled"),
|
||||
showAsteroidsInMinimap ? "Enabled" : "Disabled"),
|
||||
ButtonRow(
|
||||
"playerSettings.graphics.showAsteroids.buttons",
|
||||
Button(
|
||||
"playerSettings.graphics.showAsteroids.toggle",
|
||||
settings.ShowAsteroidsInMinimap ? "Disable Minimap Asteroids" : "Enable Minimap Asteroids",
|
||||
showAsteroidsInMinimap ? "Disable Minimap Asteroids" : "Enable Minimap Asteroids",
|
||||
AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap)))),
|
||||
Array.Empty<AetheriaRuntimeSurfaceStyleToken>()),
|
||||
commands: new[]
|
||||
|
|
|
|||
Loading…
Reference in a new issue