diff --git a/Aetheria.State.Unity/Aetheria.State.Unity.csproj b/Aetheria.State.Unity/Aetheria.State.Unity.csproj index 645c8928e..e5ae89087 100644 --- a/Aetheria.State.Unity/Aetheria.State.Unity.csproj +++ b/Aetheria.State.Unity/Aetheria.State.Unity.csproj @@ -14,6 +14,7 @@ + diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 60f7a9009..144549b81 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -1776,12 +1776,24 @@ static void RequireNoRendererLocalDebugPanels(string root) static void RequireMainMenuSettingsCommit(string root) { var mainMenuPath = Path.Combine(root, "Assets", "Scripts", "UI", "MainMenu.cs"); + var sharedCommandsPath = Path.Combine( + root, + "Packages", + "org.gamecult.aetheria.state", + "Runtime", + "AetheriaRuntimePlayerSettingsCommands.cs"); if (!File.Exists(mainMenuPath)) { throw new InvalidOperationException("Cannot verify main-menu settings commit path; MainMenu.cs is missing."); } + if (!File.Exists(sharedCommandsPath)) + { + throw new InvalidOperationException( + "Cannot verify main-menu settings command contract; AetheriaRuntimePlayerSettingsCommands.cs is missing."); + } var source = File.ReadAllText(mainMenuPath); + var sharedCommands = File.ReadAllText(sharedCommandsPath); var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs"); var actionGameManager = File.Exists(actionGameManagerPath) ? File.ReadAllText(actionGameManagerPath) @@ -1830,7 +1842,9 @@ static void RequireMainMenuSettingsCommit(string root) } var missingUiCalls = requiredCommits - .Where(symbol => !source.Contains("ActionGameManager." + symbol, StringComparison.Ordinal)) + .Where(symbol => + !source.Contains("ActionGameManager." + symbol, StringComparison.Ordinal) && + !source.Contains("InvokePlayerSettingsCommand", StringComparison.Ordinal)) .ToArray(); if (missingUiCalls.Length > 0) @@ -1839,6 +1853,67 @@ static void RequireMainMenuSettingsCommit(string root) "MainMenu no longer routes settings changes through ActionGameManager: " + string.Join(", ", missingUiCalls)); } + + var requiredSharedCommands = new[] + { + "CycleTemperatureUnit", + "DecrementSignificantDigits", + "IncrementSignificantDigits", + "CycleNebulaQuality", + "ToggleShowAsteroidsInMinimap" + }; + + var missingSharedCommands = requiredSharedCommands + .Where(symbol => !sharedCommands.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + + if (missingSharedCommands.Length > 0) + { + throw new InvalidOperationException( + "Shared player-settings Eve command contract is incomplete: " + + string.Join(", ", missingSharedCommands)); + } + + var requiredMainMenuSymbols = new[] + { + "InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit)", + "InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits)", + "InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits)", + "InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality)", + "InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap)" + }; + + var missingMainMenuSymbols = requiredMainMenuSymbols + .Where(symbol => !source.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + + if (missingMainMenuSymbols.Length > 0) + { + throw new InvalidOperationException( + "MainMenu no longer lowers shared player-settings Eve commands: " + + string.Join(", ", missingMainMenuSymbols)); + } + + var forbiddenUiFieldSymbols = new[] + { + "AddField(\"Temperature Unit\"", + "AddField(\"Significant Digits\"", + "AddField(\"Nebula Quality\"", + "AddField(\"Show Asteroids in Minimap\"" + }; + + var uiFieldHits = File.ReadLines(mainMenuPath) + .Select((line, index) => new { LineNumber = index + 1, Line = line }) + .Where(line => forbiddenUiFieldSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal))) + .Select(line => $"{Path.GetRelativePath(root, mainMenuPath)}:{line.LineNumber}: {line.Line.Trim()}") + .ToArray(); + + if (uiFieldHits.Length > 0) + { + throw new InvalidOperationException( + "MainMenu still uses legacy field widgets for Eve-owned gameplay/graphics settings: " + + string.Join("; ", uiFieldHits)); + } } static void RequirePlayerSettingsEveSurface(string root) @@ -1847,6 +1922,12 @@ static void RequirePlayerSettingsEveSurface(string root) var bridgePath = Path.Combine(root, "Aetheria.State", "AetheriaEveCommandBridge.cs"); var providerPath = Path.Combine(root, "Aetheria.State", "AetheriaProviderAdvertisementProjector.cs"); var serverPath = Path.Combine(root, "Economy.Server", "Program.cs"); + var sharedCommandsPath = Path.Combine( + root, + "Packages", + "org.gamecult.aetheria.state", + "Runtime", + "AetheriaRuntimePlayerSettingsCommands.cs"); if (!File.Exists(projectorPath)) { @@ -1856,11 +1937,11 @@ static void RequirePlayerSettingsEveSurface(string root) var projector = File.ReadAllText(projectorPath); var requiredProjectorSymbols = new[] { - "SurfaceId = \"aetheria.player_settings\"", - "aetheria.player_settings.gameplay.temperature_unit.cycle", - "aetheria.player_settings.gameplay.significant_digits.increment", - "aetheria.player_settings.graphics.nebula_quality.cycle", - "aetheria.player_settings.graphics.show_asteroids.toggle" + "AetheriaRuntimePlayerSettingsCommands.SurfaceId", + "AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit", + "AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits", + "AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality", + "AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap" }; var missingProjectorSymbols = requiredProjectorSymbols @@ -1883,6 +1964,9 @@ static void RequirePlayerSettingsEveSurface(string root) var server = File.Exists(serverPath) ? File.ReadAllText(serverPath) : throw new InvalidOperationException("Economy.Server program is missing."); + var sharedCommands = File.Exists(sharedCommandsPath) + ? File.ReadAllText(sharedCommandsPath) + : throw new InvalidOperationException("Shared player-settings Eve command contract is missing."); if (!bridge.Contains("AppliedPlayerSettingsCommands", StringComparison.Ordinal) || !bridge.Contains("ApplyPlayerSettingsCommandAsync", StringComparison.Ordinal) || @@ -1893,7 +1977,7 @@ static void RequirePlayerSettingsEveSurface(string root) } if (!provider.Contains("AetheriaPlayerSettingsSurfaceProjector.SurfaceId", StringComparison.Ordinal) || - !provider.Contains("aetheria.player_settings.refresh", StringComparison.Ordinal)) + !provider.Contains("AetheriaRuntimePlayerSettingsCommands.Refresh", StringComparison.Ordinal)) { throw new InvalidOperationException( "Provider advertisement no longer publishes the player-settings Eve surface and commands."); @@ -1905,6 +1989,13 @@ static void RequirePlayerSettingsEveSurface(string root) throw new InvalidOperationException( "Economy.Server no longer republishes the provider-owned player-settings Eve surface."); } + + if (!sharedCommands.Contains("SurfaceId = \"aetheria.player_settings\"", StringComparison.Ordinal) || + !sharedCommands.Contains("public static bool IsKnown", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Shared player-settings Eve command contract is missing the surface id or command registry helper."); + } } static void RequireMainMenuContinueRunState(string root) diff --git a/Aetheria.State/Aetheria.State.csproj b/Aetheria.State/Aetheria.State.csproj index 632998c04..446b56b1d 100644 --- a/Aetheria.State/Aetheria.State.csproj +++ b/Aetheria.State/Aetheria.State.csproj @@ -11,6 +11,7 @@ + diff --git a/Aetheria.State/AetheriaEveCommandBridge.cs b/Aetheria.State/AetheriaEveCommandBridge.cs index 8c36b3c84..946fc64dc 100644 --- a/Aetheria.State/AetheriaEveCommandBridge.cs +++ b/Aetheria.State/AetheriaEveCommandBridge.cs @@ -67,12 +67,12 @@ public static class AetheriaEveCommandBridge AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus)).ConfigureAwait(false); report.AppliedOperationsRefreshes++; break; - case "aetheria.player_settings.refresh": - case "aetheria.player_settings.gameplay.temperature_unit.cycle": - case "aetheria.player_settings.gameplay.significant_digits.decrement": - case "aetheria.player_settings.gameplay.significant_digits.increment": - case "aetheria.player_settings.graphics.nebula_quality.cycle": - case "aetheria.player_settings.graphics.show_asteroids.toggle": + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.Refresh: + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit: + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits: + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits: + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality: + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap: await ApplyPlayerSettingsCommandAsync(node, command).ConfigureAwait(false); report.AppliedPlayerSettingsCommands++; break; @@ -113,17 +113,7 @@ public static class AetheriaEveCommandBridge (string.Equals(surfaceId, AetheriaOperationsSurfaceProjector.SurfaceId, StringComparison.Ordinal) && string.Equals(command, "aetheria.operations.refresh", StringComparison.Ordinal)) || (string.Equals(surfaceId, AetheriaPlayerSettingsSurfaceProjector.SurfaceId, StringComparison.Ordinal) && - KnownPlayerSettingsCommand(command)); - } - - private static bool KnownPlayerSettingsCommand(string command) - { - return string.Equals(command, "aetheria.player_settings.refresh", StringComparison.Ordinal) || - string.Equals(command, "aetheria.player_settings.gameplay.temperature_unit.cycle", StringComparison.Ordinal) || - string.Equals(command, "aetheria.player_settings.gameplay.significant_digits.decrement", StringComparison.Ordinal) || - string.Equals(command, "aetheria.player_settings.gameplay.significant_digits.increment", StringComparison.Ordinal) || - string.Equals(command, "aetheria.player_settings.graphics.nebula_quality.cycle", StringComparison.Ordinal) || - string.Equals(command, "aetheria.player_settings.graphics.show_asteroids.toggle", StringComparison.Ordinal); + GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IsKnown(command)); } private static async Task ApplyPlayerSettingsCommandAsync( @@ -137,7 +127,7 @@ public static class AetheriaEveCommandBridge switch (command.Command) { - case "aetheria.player_settings.gameplay.temperature_unit.cycle": + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit: settings.Gameplay.TemperatureUnit = Cycle( settings.Gameplay.TemperatureUnit, "Kelvin", @@ -145,16 +135,16 @@ public static class AetheriaEveCommandBridge "Fahrenheit"); persistSettings = true; break; - case "aetheria.player_settings.gameplay.significant_digits.decrement": + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits: settings.Gameplay.SignificantDigits = Math.Max(0, settings.Gameplay.SignificantDigits - 1); persistSettings = true; break; - case "aetheria.player_settings.gameplay.significant_digits.increment": + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits: if (settings.Gameplay.SignificantDigits < int.MaxValue) settings.Gameplay.SignificantDigits++; persistSettings = true; break; - case "aetheria.player_settings.graphics.nebula_quality.cycle": + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality: settings.Graphics.NebulaQuality = Cycle( settings.Graphics.NebulaQuality, "Low", @@ -163,7 +153,7 @@ public static class AetheriaEveCommandBridge "Ultra"); persistSettings = true; break; - case "aetheria.player_settings.graphics.show_asteroids.toggle": + case GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap: settings.Graphics.ShowAsteroidsInMinimap = !settings.Graphics.ShowAsteroidsInMinimap; persistSettings = true; break; diff --git a/Aetheria.State/AetheriaPlayerSettingsSurfaceProjector.cs b/Aetheria.State/AetheriaPlayerSettingsSurfaceProjector.cs index ba8da6947..5d2424c36 100644 --- a/Aetheria.State/AetheriaPlayerSettingsSurfaceProjector.cs +++ b/Aetheria.State/AetheriaPlayerSettingsSurfaceProjector.cs @@ -6,7 +6,7 @@ namespace Aetheria.State; public static class AetheriaPlayerSettingsSurfaceProjector { public const string SurfaceKey = "eve:surface:aetheria.player_settings"; - public const string SurfaceId = "aetheria.player_settings"; + public const string SurfaceId = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.SurfaceId; public static EveSurfaceState Build( AetheriaPlayerSettings? settings, @@ -56,7 +56,7 @@ public static class AetheriaPlayerSettingsSurfaceProjector Button( "playerSettings.gameplay.temperatureUnit.cycle", "Cycle Temperature Unit", - "aetheria.player_settings.gameplay.temperature_unit.cycle")), + GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit)), Metric( "playerSettings.gameplay.significantDigits", "Significant Digits", @@ -66,11 +66,11 @@ public static class AetheriaPlayerSettingsSurfaceProjector Button( "playerSettings.gameplay.significantDigits.decrement", "Digits -", - "aetheria.player_settings.gameplay.significant_digits.decrement"), + GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits), Button( "playerSettings.gameplay.significantDigits.increment", "Digits +", - "aetheria.player_settings.gameplay.significant_digits.increment"))), + GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits))), Node( "aetheria.playerSettings.graphics", "card", @@ -81,7 +81,7 @@ public static class AetheriaPlayerSettingsSurfaceProjector Button( "playerSettings.graphics.nebulaQuality.cycle", "Cycle Nebula Quality", - "aetheria.player_settings.graphics.nebula_quality.cycle")), + GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality)), Metric( "playerSettings.graphics.showAsteroids", "Show Asteroids In Minimap", @@ -91,43 +91,43 @@ public static class AetheriaPlayerSettingsSurfaceProjector Button( "playerSettings.graphics.showAsteroids.toggle", graphics.ShowAsteroidsInMinimap ? "Disable Minimap Asteroids" : "Enable Minimap Asteroids", - "aetheria.player_settings.graphics.show_asteroids.toggle")))) + GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap)))) }, Commands = [ new EveCommandTemplate { - Command = "aetheria.player_settings.refresh", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.Refresh, Label = "Refresh", Transport = "cultmesh" }, new EveCommandTemplate { - Command = "aetheria.player_settings.gameplay.temperature_unit.cycle", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit, Label = "Cycle Temperature Unit", Transport = "cultmesh" }, new EveCommandTemplate { - Command = "aetheria.player_settings.gameplay.significant_digits.decrement", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits, Label = "Digits -", Transport = "cultmesh" }, new EveCommandTemplate { - Command = "aetheria.player_settings.gameplay.significant_digits.increment", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits, Label = "Digits +", Transport = "cultmesh" }, new EveCommandTemplate { - Command = "aetheria.player_settings.graphics.nebula_quality.cycle", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality, Label = "Cycle Nebula Quality", Transport = "cultmesh" }, new EveCommandTemplate { - Command = "aetheria.player_settings.graphics.show_asteroids.toggle", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap, Label = "Toggle Minimap Asteroids", Transport = "cultmesh" } diff --git a/Aetheria.State/AetheriaProviderAdvertisementProjector.cs b/Aetheria.State/AetheriaProviderAdvertisementProjector.cs index c148f6e68..8cee46635 100644 --- a/Aetheria.State/AetheriaProviderAdvertisementProjector.cs +++ b/Aetheria.State/AetheriaProviderAdvertisementProjector.cs @@ -85,32 +85,32 @@ public static class AetheriaProviderAdvertisementProjector }, new EveProviderCommandRef { - Command = "aetheria.player_settings.refresh", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.Refresh, Summary = "Refresh player settings projection" }, new EveProviderCommandRef { - Command = "aetheria.player_settings.gameplay.temperature_unit.cycle", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit, Summary = "Cycle the typed player temperature unit" }, new EveProviderCommandRef { - Command = "aetheria.player_settings.gameplay.significant_digits.decrement", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits, Summary = "Decrease typed player significant digits" }, new EveProviderCommandRef { - Command = "aetheria.player_settings.gameplay.significant_digits.increment", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits, Summary = "Increase typed player significant digits" }, new EveProviderCommandRef { - Command = "aetheria.player_settings.graphics.nebula_quality.cycle", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality, Summary = "Cycle typed player nebula quality" }, new EveProviderCommandRef { - Command = "aetheria.player_settings.graphics.show_asteroids.toggle", + Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap, Summary = "Toggle typed player minimap asteroid visibility" } ] diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index bc02a5570..66d06b635 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -285,13 +285,21 @@ public class MainMenu : MonoBehaviour _nextMenu.panel.AddField("Name", () => ActionGameManager.RuntimePlayerSettings.Name, ActionGameManager.CommitRuntimePlayerName); - _nextMenu.panel.AddField("Temperature Unit", - () => (int) ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit, - i => ActionGameManager.CommitRuntimeTemperatureUnit((TemperatureUnit) i), - Enum.GetNames(typeof(TemperatureUnit))); - _nextMenu.panel.AddField("Significant Digits", - () => ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits, - ActionGameManager.CommitRuntimeSignificantDigits); + _nextMenu.panel.AddProperty( + "Temperature Unit", + () => ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit.ToString()); + _nextMenu.panel.AddButton( + "Cycle Temperature Unit", + () => InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit)); + _nextMenu.panel.AddProperty( + "Significant Digits", + () => ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits.ToString()); + _nextMenu.panel.AddButton( + "Digits -", + () => InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits)); + _nextMenu.panel.AddButton( + "Digits +", + () => InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits)); _nextMenu.panel.AddButton("Back", CommitRuntimeSettingsAndReturn); } @@ -300,17 +308,20 @@ public class MainMenu : MonoBehaviour { _nextMenu.panel.Clear(); _nextMenu.panel.Title.text = TitleSubtitle("graphics", "settings"); - _nextMenu.panel.AddField("Nebula Quality", - () => (int)ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality, - i => - { - ActionGameManager.CommitRuntimeNebulaQuality((Quality)i); - CloudRenderer.quality = ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality; - }, - Enum.GetNames(typeof(Quality))); - _nextMenu.panel.AddField("Show Asteroids in Minimap", - () => ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap, - ActionGameManager.CommitRuntimeShowAsteroidsInMinimap); + _nextMenu.panel.AddProperty( + "Nebula Quality", + () => ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality.ToString()); + _nextMenu.panel.AddButton( + "Cycle Nebula Quality", + () => InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality)); + _nextMenu.panel.AddProperty( + "Show Asteroids in Minimap", + () => ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap ? "Enabled" : "Disabled"); + _nextMenu.panel.AddButton( + ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap + ? "Disable Minimap Asteroids" + : "Enable Minimap Asteroids", + () => InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap)); _nextMenu.panel.AddButton("Back", CommitRuntimeSettingsAndReturn); } @@ -339,6 +350,48 @@ public class MainMenu : MonoBehaviour }); } + private void InvokePlayerSettingsCommand(string command) + { + switch (command) + { + case AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit: + ActionGameManager.CommitRuntimeTemperatureUnit( + ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit switch + { + TemperatureUnit.Kelvin => TemperatureUnit.Celsius, + TemperatureUnit.Celsius => TemperatureUnit.Fahrenheit, + _ => TemperatureUnit.Kelvin + }); + break; + case AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits: + ActionGameManager.CommitRuntimeSignificantDigits( + max(0, ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits - 1)); + break; + case AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits: + ActionGameManager.CommitRuntimeSignificantDigits( + ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits + 1); + break; + case AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality: + ActionGameManager.CommitRuntimeNebulaQuality( + ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality switch + { + Quality.Low => Quality.Normal, + Quality.Normal => Quality.High, + Quality.High => Quality.Ultra, + _ => Quality.Low + }); + CloudRenderer.quality = ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality; + break; + case AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap: + ActionGameManager.CommitRuntimeShowAsteroidsInMinimap( + !ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap); + break; + default: + Debug.LogWarning($"Unknown player-settings command: {command}"); + break; + } + } + private void CommitRuntimeSettingsAndReturn() { ShowSettings(); diff --git a/GameData/aetheria-world.cc b/GameData/aetheria-world.cc index c48465557..dd3f45a7d 100644 Binary files a/GameData/aetheria-world.cc and b/GameData/aetheria-world.cc differ diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsCommands.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsCommands.cs new file mode 100644 index 000000000..23fd864ec --- /dev/null +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimePlayerSettingsCommands.cs @@ -0,0 +1,23 @@ +namespace GameCult.Aetheria.State.Unity +{ + public static class AetheriaRuntimePlayerSettingsCommands + { + public const string SurfaceId = "aetheria.player_settings"; + public const string Refresh = "aetheria.player_settings.refresh"; + public const string CycleTemperatureUnit = "aetheria.player_settings.gameplay.temperature_unit.cycle"; + public const string DecrementSignificantDigits = "aetheria.player_settings.gameplay.significant_digits.decrement"; + public const string IncrementSignificantDigits = "aetheria.player_settings.gameplay.significant_digits.increment"; + public const string CycleNebulaQuality = "aetheria.player_settings.graphics.nebula_quality.cycle"; + public const string ToggleShowAsteroidsInMinimap = "aetheria.player_settings.graphics.show_asteroids.toggle"; + + public static bool IsKnown(string command) + { + return command == Refresh || + command == CycleTemperatureUnit || + command == DecrementSignificantDigits || + command == IncrementSignificantDigits || + command == CycleNebulaQuality || + command == ToggleShowAsteroidsInMinimap; + } + } +}