Lower MainMenu settings from shared Eve surface
This commit is contained in:
parent
a1d04293bc
commit
a310c497a8
167 changed files with 815 additions and 405 deletions
|
|
@ -14,7 +14,6 @@
|
|||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeBehaviorMetadata.cs" Link="AetheriaRuntimeBehaviorMetadata.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeBehaviorKinds.cs" Link="AetheriaRuntimeBehaviorKinds.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeItemCategories.cs" Link="AetheriaRuntimeItemCategories.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePlayerSettingsCommands.cs" Link="AetheriaRuntimePlayerSettingsCommands.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePendingCultCacheStore.cs" Link="AetheriaRuntimePendingCultCacheStore.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeEveCommandLog.cs" Link="AetheriaRuntimeEveCommandLog.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeStateCommitLog.cs" Link="AetheriaRuntimeStateCommitLog.cs" />
|
||||
|
|
|
|||
|
|
@ -1782,6 +1782,12 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
"org.gamecult.aetheria.state",
|
||||
"Runtime",
|
||||
"AetheriaRuntimePlayerSettingsCommands.cs");
|
||||
var surfaceBuilderPath = Path.Combine(
|
||||
root,
|
||||
"Packages",
|
||||
"org.gamecult.aetheria.state",
|
||||
"Runtime",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.cs");
|
||||
if (!File.Exists(mainMenuPath))
|
||||
{
|
||||
throw new InvalidOperationException("Cannot verify main-menu settings commit path; MainMenu.cs is missing.");
|
||||
|
|
@ -1791,9 +1797,15 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
throw new InvalidOperationException(
|
||||
"Cannot verify main-menu settings command contract; AetheriaRuntimePlayerSettingsCommands.cs is missing.");
|
||||
}
|
||||
if (!File.Exists(surfaceBuilderPath))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Cannot verify main-menu settings surface contract; AetheriaRuntimePlayerSettingsSurfaceBuilder.cs is missing.");
|
||||
}
|
||||
|
||||
var source = File.ReadAllText(mainMenuPath);
|
||||
var sharedCommands = File.ReadAllText(sharedCommandsPath);
|
||||
var surfaceBuilder = File.ReadAllText(surfaceBuilderPath);
|
||||
var actionGameManagerPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs");
|
||||
var actionGameManager = File.Exists(actionGameManagerPath)
|
||||
? File.ReadAllText(actionGameManagerPath)
|
||||
|
|
@ -1805,7 +1817,8 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
"CommitRuntimeTemperatureUnit",
|
||||
"CommitRuntimeSignificantDigits",
|
||||
"CommitRuntimeNebulaQuality",
|
||||
"CommitRuntimeShowAsteroidsInMinimap"
|
||||
"CommitRuntimeShowAsteroidsInMinimap",
|
||||
"CommitRuntimePlayerSettingsCommand"
|
||||
};
|
||||
|
||||
var missingCommits = requiredCommits
|
||||
|
|
@ -1841,10 +1854,14 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
string.Join("; ", hits));
|
||||
}
|
||||
|
||||
var missingUiCalls = requiredCommits
|
||||
.Where(symbol =>
|
||||
!source.Contains("ActionGameManager." + symbol, StringComparison.Ordinal) &&
|
||||
!source.Contains("InvokePlayerSettingsCommand", StringComparison.Ordinal))
|
||||
var requiredMainMenuAuthoritySymbols = new[]
|
||||
{
|
||||
"ActionGameManager.CommitRuntimePlayerName",
|
||||
"ActionGameManager.CommitRuntimePlayerSettingsCommand"
|
||||
};
|
||||
|
||||
var missingUiCalls = requiredMainMenuAuthoritySymbols
|
||||
.Where(symbol => !source.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
|
||||
if (missingUiCalls.Length > 0)
|
||||
|
|
@ -1874,13 +1891,33 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
string.Join(", ", missingSharedCommands));
|
||||
}
|
||||
|
||||
var requiredSurfaceBuilderSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder",
|
||||
"AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit",
|
||||
"AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits",
|
||||
"AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits",
|
||||
"AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality",
|
||||
"AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap"
|
||||
};
|
||||
|
||||
var missingSurfaceBuilderSymbols = requiredSurfaceBuilderSymbols
|
||||
.Where(symbol => !surfaceBuilder.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
|
||||
if (missingSurfaceBuilderSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Shared player-settings Eve surface builder is incomplete: " +
|
||||
string.Join(", ", missingSurfaceBuilderSymbols));
|
||||
}
|
||||
|
||||
var requiredMainMenuSymbols = new[]
|
||||
{
|
||||
"InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit)",
|
||||
"InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits)",
|
||||
"InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits)",
|
||||
"InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality)",
|
||||
"InvokePlayerSettingsCommand(AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap)"
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build",
|
||||
"new EveUiToolkitSurfaceLowerer",
|
||||
"ActionGameManager.CommitRuntimePlayerSettingsCommand",
|
||||
"new TextField(\"Name\")"
|
||||
};
|
||||
|
||||
var missingMainMenuSymbols = requiredMainMenuSymbols
|
||||
|
|
@ -1890,7 +1927,7 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
if (missingMainMenuSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"MainMenu no longer lowers shared player-settings Eve commands: " +
|
||||
"MainMenu no longer lowers the shared player-settings Eve surface contract: " +
|
||||
string.Join(", ", missingMainMenuSymbols));
|
||||
}
|
||||
|
||||
|
|
@ -1899,7 +1936,9 @@ static void RequireMainMenuSettingsCommit(string root)
|
|||
"AddField(\"Temperature Unit\"",
|
||||
"AddField(\"Significant Digits\"",
|
||||
"AddField(\"Nebula Quality\"",
|
||||
"AddField(\"Show Asteroids in Minimap\""
|
||||
"AddField(\"Show Asteroids in Minimap\"",
|
||||
"ShowGameplaySettings()",
|
||||
"ShowGraphicsSettings()"
|
||||
};
|
||||
|
||||
var uiFieldHits = File.ReadLines(mainMenuPath)
|
||||
|
|
@ -1928,6 +1967,12 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
"org.gamecult.aetheria.state",
|
||||
"Runtime",
|
||||
"AetheriaRuntimePlayerSettingsCommands.cs");
|
||||
var surfaceBuilderPath = Path.Combine(
|
||||
root,
|
||||
"Packages",
|
||||
"org.gamecult.aetheria.state",
|
||||
"Runtime",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.cs");
|
||||
|
||||
if (!File.Exists(projectorPath))
|
||||
{
|
||||
|
|
@ -1938,10 +1983,9 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
var requiredProjectorSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimePlayerSettingsCommands.SurfaceId",
|
||||
"AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit",
|
||||
"AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits",
|
||||
"AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality",
|
||||
"AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap"
|
||||
"AetheriaRuntimePlayerSettingsSurfaceBuilder.Build",
|
||||
"AetheriaRuntimePlayerSettingsSurfaceState",
|
||||
"settings.ActiveRunKey"
|
||||
};
|
||||
|
||||
var missingProjectorSymbols = requiredProjectorSymbols
|
||||
|
|
@ -1967,6 +2011,9 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
var sharedCommands = File.Exists(sharedCommandsPath)
|
||||
? File.ReadAllText(sharedCommandsPath)
|
||||
: throw new InvalidOperationException("Shared player-settings Eve command contract is missing.");
|
||||
var surfaceBuilder = File.Exists(surfaceBuilderPath)
|
||||
? File.ReadAllText(surfaceBuilderPath)
|
||||
: throw new InvalidOperationException("Shared player-settings Eve surface builder is missing.");
|
||||
|
||||
if (!bridge.Contains("AppliedPlayerSettingsCommands", StringComparison.Ordinal) ||
|
||||
!bridge.Contains("ApplyPlayerSettingsCommandAsync", StringComparison.Ordinal) ||
|
||||
|
|
@ -1996,6 +2043,12 @@ static void RequirePlayerSettingsEveSurface(string root)
|
|||
throw new InvalidOperationException(
|
||||
"Shared player-settings Eve command contract is missing the surface id or command registry helper.");
|
||||
}
|
||||
|
||||
if (!surfaceBuilder.Contains("public static class AetheriaRuntimePlayerSettingsSurfaceBuilder", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Shared player-settings Eve surface builder no longer owns the portable settings surface contract.");
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireMainMenuContinueRunState(string root)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeStateCommitDocument.cs" Link="AetheriaRuntimeStateCommitDocument.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeEveCommandDocument.cs" Link="AetheriaRuntimeEveCommandDocument.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePendingCultCacheStore.cs" Link="AetheriaRuntimePendingCultCacheStore.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePlayerSettingsSurfaceBuilder.cs" Link="AetheriaRuntimePlayerSettingsSurfaceBuilder.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePlayerSettingsCommands.cs" Link="AetheriaRuntimePlayerSettingsCommands.cs" />
|
||||
<ProjectReference Include="..\..\CultLib\src\GameCult.Caching\GameCult.Caching.csproj" />
|
||||
<ProjectReference Include="..\..\CultLib\src\GameCult.Caching.MessagePack\GameCult.Caching.MessagePack.csproj" />
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aetheria.State.Documents;
|
||||
using GameCult.Aetheria.State.Unity;
|
||||
|
||||
namespace Aetheria.State;
|
||||
|
||||
public static class AetheriaPlayerSettingsSurfaceProjector
|
||||
{
|
||||
public const string SurfaceKey = "eve:surface:aetheria.player_settings";
|
||||
public const string SurfaceId = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.SurfaceId;
|
||||
public const string SurfaceId = AetheriaRuntimePlayerSettingsCommands.SurfaceId;
|
||||
|
||||
public static EveSurfaceState Build(
|
||||
AetheriaPlayerSettings? settings,
|
||||
|
|
@ -20,158 +23,56 @@ public static class AetheriaPlayerSettingsSurfaceProjector
|
|||
? settings.LastUpdatedAtUtc
|
||||
: updatedAtUtc;
|
||||
|
||||
var surface = AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(
|
||||
new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
settings.PlayerName,
|
||||
settings.TutorialPassed,
|
||||
settings.ActiveRunKey,
|
||||
gameplay.TemperatureUnit,
|
||||
gameplay.SignificantDigits,
|
||||
graphics.NebulaQuality,
|
||||
graphics.ShowAsteroidsInMinimap,
|
||||
publishedAtUtc),
|
||||
version);
|
||||
|
||||
return new EveSurfaceState
|
||||
{
|
||||
ProviderId = "aetheria",
|
||||
ProviderKind = "game.runtime",
|
||||
Title = "Aetheria Player Settings",
|
||||
Version = version,
|
||||
UpdatedAtUtc = publishedAtUtc,
|
||||
ProviderId = surface.ProviderId,
|
||||
ProviderKind = surface.ProviderKind,
|
||||
Title = surface.Title,
|
||||
Version = surface.Version,
|
||||
UpdatedAtUtc = surface.UpdatedAtUtc,
|
||||
Surface = new EveSurface
|
||||
{
|
||||
Id = SurfaceId,
|
||||
Root = Node(
|
||||
"aetheria.playerSettings.root",
|
||||
"surface",
|
||||
[],
|
||||
Node(
|
||||
"aetheria.playerSettings.summary",
|
||||
"card",
|
||||
[("title", "Player Settings")],
|
||||
Row(
|
||||
"playerSettings.summary.values",
|
||||
("playerName", settings.PlayerName),
|
||||
("tutorialPassed", settings.TutorialPassed ? "Yes" : "No"),
|
||||
("activeRun", settings.ActiveRunKey)),
|
||||
Text(
|
||||
"playerSettings.summary.note",
|
||||
"Input remapping still lives on the runtime-owned screen until Eve grows typed rebinding controls.")),
|
||||
Node(
|
||||
"aetheria.playerSettings.gameplay",
|
||||
"card",
|
||||
[("title", "Gameplay")],
|
||||
Metric("playerSettings.gameplay.temperatureUnit", "Temperature Unit", gameplay.TemperatureUnit),
|
||||
ButtonRow(
|
||||
"playerSettings.gameplay.temperatureUnit.buttons",
|
||||
Button(
|
||||
"playerSettings.gameplay.temperatureUnit.cycle",
|
||||
"Cycle Temperature Unit",
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit)),
|
||||
Metric(
|
||||
"playerSettings.gameplay.significantDigits",
|
||||
"Significant Digits",
|
||||
gameplay.SignificantDigits.ToString()),
|
||||
ButtonRow(
|
||||
"playerSettings.gameplay.significantDigits.buttons",
|
||||
Button(
|
||||
"playerSettings.gameplay.significantDigits.decrement",
|
||||
"Digits -",
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits),
|
||||
Button(
|
||||
"playerSettings.gameplay.significantDigits.increment",
|
||||
"Digits +",
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits))),
|
||||
Node(
|
||||
"aetheria.playerSettings.graphics",
|
||||
"card",
|
||||
[("title", "Graphics")],
|
||||
Metric("playerSettings.graphics.nebulaQuality", "Nebula Quality", graphics.NebulaQuality),
|
||||
ButtonRow(
|
||||
"playerSettings.graphics.nebulaQuality.buttons",
|
||||
Button(
|
||||
"playerSettings.graphics.nebulaQuality.cycle",
|
||||
"Cycle Nebula Quality",
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality)),
|
||||
Metric(
|
||||
"playerSettings.graphics.showAsteroids",
|
||||
"Show Asteroids In Minimap",
|
||||
graphics.ShowAsteroidsInMinimap ? "Enabled" : "Disabled"),
|
||||
ButtonRow(
|
||||
"playerSettings.graphics.showAsteroids.buttons",
|
||||
Button(
|
||||
"playerSettings.graphics.showAsteroids.toggle",
|
||||
graphics.ShowAsteroidsInMinimap ? "Disable Minimap Asteroids" : "Enable Minimap Asteroids",
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap))))
|
||||
Id = surface.Surface.Id,
|
||||
Root = ConvertComponent(surface.Surface.Root),
|
||||
Styles = surface.Surface.Styles
|
||||
.Select(style => new EveStyleToken
|
||||
{
|
||||
Name = style.Name,
|
||||
Value = style.Value
|
||||
})
|
||||
.ToArray()
|
||||
},
|
||||
Commands =
|
||||
[
|
||||
new EveCommandTemplate
|
||||
Commands = surface.Commands
|
||||
.Select(command => new EveCommandTemplate
|
||||
{
|
||||
Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.Refresh,
|
||||
Label = "Refresh",
|
||||
Transport = "cultmesh"
|
||||
},
|
||||
new EveCommandTemplate
|
||||
{
|
||||
Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit,
|
||||
Label = "Cycle Temperature Unit",
|
||||
Transport = "cultmesh"
|
||||
},
|
||||
new EveCommandTemplate
|
||||
{
|
||||
Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits,
|
||||
Label = "Digits -",
|
||||
Transport = "cultmesh"
|
||||
},
|
||||
new EveCommandTemplate
|
||||
{
|
||||
Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits,
|
||||
Label = "Digits +",
|
||||
Transport = "cultmesh"
|
||||
},
|
||||
new EveCommandTemplate
|
||||
{
|
||||
Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality,
|
||||
Label = "Cycle Nebula Quality",
|
||||
Transport = "cultmesh"
|
||||
},
|
||||
new EveCommandTemplate
|
||||
{
|
||||
Command = GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap,
|
||||
Label = "Toggle Minimap Asteroids",
|
||||
Transport = "cultmesh"
|
||||
}
|
||||
]
|
||||
Command = command.Command,
|
||||
Label = command.Label,
|
||||
Transport = command.Transport
|
||||
})
|
||||
.ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent Metric(string id, string label, string value)
|
||||
{
|
||||
return Node(id, "metric", [("label", label), ("value", value)]);
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent Text(string id, string value)
|
||||
{
|
||||
return Node(id, "text", [("value", value)]);
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent Button(string id, string label, string command)
|
||||
{
|
||||
return Node(id, "control.button", [("label", label), ("command", command)]);
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent ButtonRow(string id, params EveSurfaceComponent[] children)
|
||||
{
|
||||
return Node(id, "row", [], children);
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent Row(string id, params (string Key, string Value)[] props)
|
||||
{
|
||||
return Node(id, "row", props);
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent Node(
|
||||
string id,
|
||||
string kind,
|
||||
(string Key, string Value)[] props,
|
||||
params EveSurfaceComponent[] children)
|
||||
private static EveSurfaceComponent ConvertComponent(AetheriaRuntimeSurfaceComponent component)
|
||||
{
|
||||
return new EveSurfaceComponent
|
||||
{
|
||||
Id = id,
|
||||
Kind = kind,
|
||||
Props = props.ToDictionary(prop => prop.Key, prop => prop.Value),
|
||||
Children = children
|
||||
Id = component.Id,
|
||||
Kind = component.Kind,
|
||||
Props = new Dictionary<string, string>(component.Props, StringComparer.Ordinal),
|
||||
Children = component.Children.Select(ConvertComponent).ToArray()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,6 +329,10 @@ proves a typed run can reference a typed zone, the zone can preserve
|
|||
orbit/body rows and reference typed entity snapshots, and entity snapshots can
|
||||
preserve equipment slots, weapon groups, and simulation stat grids without
|
||||
reviving `PlayerSettings.msgpack`, `.loadout`, or `.zone` serialization.
|
||||
Unity `MainMenu` now lowers that same player-settings Eve document contract
|
||||
locally through UI Toolkit instead of hand-authoring separate gameplay/graphics
|
||||
widgets; the menu shell keeps name entry and back-navigation while gameplay
|
||||
still owns command semantics through `ActionGameManager.CommitRuntimePlayerSettingsCommand`.
|
||||
The run document also carries `CurrentEntityKey`, so Continue restore binds the
|
||||
saved player entity by exact typed record identity instead of reconstructing it
|
||||
from a transient entity-slot index. Canonical typed run state no longer stores
|
||||
|
|
|
|||
|
|
@ -116,6 +116,43 @@ public class ActionGameManager : MonoBehaviour
|
|||
QueueRuntimePlayerSettingsCommit();
|
||||
}
|
||||
|
||||
public static bool CommitRuntimePlayerSettingsCommand(string command)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit:
|
||||
CommitRuntimeTemperatureUnit(
|
||||
RuntimePlayerSettings.GameplaySettings.TemperatureUnit switch
|
||||
{
|
||||
TemperatureUnit.Kelvin => TemperatureUnit.Celsius,
|
||||
TemperatureUnit.Celsius => TemperatureUnit.Fahrenheit,
|
||||
_ => TemperatureUnit.Kelvin
|
||||
});
|
||||
return true;
|
||||
case AetheriaRuntimePlayerSettingsCommands.DecrementSignificantDigits:
|
||||
CommitRuntimeSignificantDigits(max(0, RuntimePlayerSettings.GameplaySettings.SignificantDigits - 1));
|
||||
return true;
|
||||
case AetheriaRuntimePlayerSettingsCommands.IncrementSignificantDigits:
|
||||
CommitRuntimeSignificantDigits(RuntimePlayerSettings.GameplaySettings.SignificantDigits + 1);
|
||||
return true;
|
||||
case AetheriaRuntimePlayerSettingsCommands.CycleNebulaQuality:
|
||||
CommitRuntimeNebulaQuality(
|
||||
RuntimePlayerSettings.GraphicsSettings.NebulaQuality switch
|
||||
{
|
||||
Quality.Low => Quality.Normal,
|
||||
Quality.Normal => Quality.High,
|
||||
Quality.High => Quality.Ultra,
|
||||
_ => Quality.Low
|
||||
});
|
||||
return true;
|
||||
case AetheriaRuntimePlayerSettingsCommands.ToggleShowAsteroidsInMinimap:
|
||||
CommitRuntimeShowAsteroidsInMinimap(!RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static RuntimePlayerSettings CreateDefaultRuntimePlayerSettings()
|
||||
{
|
||||
var settings = new RuntimePlayerSettings();
|
||||
|
|
|
|||
|
|
@ -6,11 +6,14 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using GameCult.Aetheria.State.Unity;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Eve.UnityUIToolkit;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using static Unity.Mathematics.math;
|
||||
using float2 = Unity.Mathematics.float2;
|
||||
using Random = UnityEngine.Random;
|
||||
|
|
@ -32,6 +35,7 @@ public class MainMenu : MonoBehaviour
|
|||
private float _fadeLerp;
|
||||
private bool _fading;
|
||||
private Vector3 _panelPosition;
|
||||
private UIDocument _playerSettingsSurfaceDocument;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
|
@ -86,6 +90,7 @@ public class MainMenu : MonoBehaviour
|
|||
|
||||
private void ShowMain()
|
||||
{
|
||||
HidePlayerSettingsSurface();
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.Title.text = TitleSubtitle("aetheria", "terminus");
|
||||
if (!InGame)
|
||||
|
|
@ -244,18 +249,13 @@ public class MainMenu : MonoBehaviour
|
|||
|
||||
private void ShowSettings()
|
||||
{
|
||||
HidePlayerSettingsSurface();
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.Title.text = "settings";
|
||||
_nextMenu.panel.AddButton("Gameplay",
|
||||
_nextMenu.panel.AddButton("Player Settings",
|
||||
() =>
|
||||
{
|
||||
ShowGameplaySettings();
|
||||
Fade(true);
|
||||
});
|
||||
_nextMenu.panel.AddButton("Graphics",
|
||||
() =>
|
||||
{
|
||||
ShowGraphicsSettings();
|
||||
ShowPlayerSettingsSurface();
|
||||
Fade(true);
|
||||
});
|
||||
_nextMenu.panel.AddButton("Input",
|
||||
|
|
@ -277,57 +277,10 @@ public class MainMenu : MonoBehaviour
|
|||
Fade(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void ShowGameplaySettings()
|
||||
{
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.Title.text = TitleSubtitle("gameplay", "settings");
|
||||
_nextMenu.panel.AddField("Name",
|
||||
() => ActionGameManager.RuntimePlayerSettings.Name,
|
||||
ActionGameManager.CommitRuntimePlayerName);
|
||||
_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);
|
||||
}
|
||||
|
||||
private void ShowGraphicsSettings()
|
||||
{
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.Title.text = TitleSubtitle("graphics", "settings");
|
||||
_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);
|
||||
}
|
||||
|
||||
private void ShowInputSettings()
|
||||
{
|
||||
HidePlayerSettingsSurface();
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.Title.text = TitleSubtitle("input", "settings");
|
||||
_nextMenu.panel.AddButton("Back",
|
||||
|
|
@ -340,6 +293,7 @@ public class MainMenu : MonoBehaviour
|
|||
|
||||
private void ShowAudioSettings()
|
||||
{
|
||||
HidePlayerSettingsSurface();
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.Title.text = TitleSubtitle("audio", "settings");
|
||||
_nextMenu.panel.AddButton("Back",
|
||||
|
|
@ -350,51 +304,171 @@ public class MainMenu : MonoBehaviour
|
|||
});
|
||||
}
|
||||
|
||||
private void InvokePlayerSettingsCommand(string command)
|
||||
private void ShowPlayerSettingsSurface()
|
||||
{
|
||||
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;
|
||||
}
|
||||
_nextMenu.panel.Clear();
|
||||
_nextMenu.panel.gameObject.SetActive(false);
|
||||
RenderPlayerSettingsSurface();
|
||||
}
|
||||
|
||||
private void CommitRuntimeSettingsAndReturn()
|
||||
private void RenderPlayerSettingsSurface()
|
||||
{
|
||||
ShowSettings();
|
||||
Fade(false);
|
||||
var document = ResolvePlayerSettingsSurfaceDocument();
|
||||
document.gameObject.SetActive(true);
|
||||
|
||||
var root = document.rootVisualElement;
|
||||
root.Clear();
|
||||
root.style.flexGrow = 1;
|
||||
root.style.justifyContent = Justify.Center;
|
||||
root.style.alignItems = Align.Center;
|
||||
root.style.paddingLeft = 24;
|
||||
root.style.paddingRight = 24;
|
||||
root.style.paddingTop = 24;
|
||||
root.style.paddingBottom = 24;
|
||||
root.style.backgroundColor = new Color(0f, 0f, 0f, 0.6f);
|
||||
|
||||
var shell = new VisualElement();
|
||||
shell.style.flexDirection = FlexDirection.Column;
|
||||
shell.style.width = 560;
|
||||
shell.style.maxWidth = 560;
|
||||
shell.style.paddingLeft = 20;
|
||||
shell.style.paddingRight = 20;
|
||||
shell.style.paddingTop = 20;
|
||||
shell.style.paddingBottom = 20;
|
||||
shell.style.backgroundColor = new Color(0.08f, 0.1f, 0.14f, 0.96f);
|
||||
root.Add(shell);
|
||||
|
||||
var title = new Label("Player Settings");
|
||||
title.style.unityFontStyleAndWeight = FontStyle.Bold;
|
||||
title.style.fontSize = 24;
|
||||
title.style.marginBottom = 6;
|
||||
shell.Add(title);
|
||||
|
||||
var subtitle = new Label("Shared Eve surface lowered locally while gameplay keeps commit authority.");
|
||||
subtitle.style.marginBottom = 12;
|
||||
shell.Add(subtitle);
|
||||
|
||||
var nameField = new TextField("Name")
|
||||
{
|
||||
value = ActionGameManager.RuntimePlayerSettings.Name
|
||||
};
|
||||
nameField.style.marginBottom = 14;
|
||||
nameField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
if (string.Equals(evt.newValue, ActionGameManager.RuntimePlayerSettings.Name, StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
ActionGameManager.CommitRuntimePlayerName(evt.newValue);
|
||||
RenderPlayerSettingsSurface();
|
||||
});
|
||||
shell.Add(nameField);
|
||||
|
||||
var lowerer = new EveUiToolkitSurfaceLowerer();
|
||||
var surface = lowerer.Lower(
|
||||
ToEveSurfaceDocument(BuildPlayerSettingsSurfaceDefinition()),
|
||||
request =>
|
||||
{
|
||||
if (!ActionGameManager.CommitRuntimePlayerSettingsCommand(request.Command))
|
||||
{
|
||||
Debug.LogWarning($"Unknown player-settings command: {request.Command}");
|
||||
return;
|
||||
}
|
||||
|
||||
CloudRenderer.quality = ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality;
|
||||
RenderPlayerSettingsSurface();
|
||||
});
|
||||
surface.style.marginBottom = 14;
|
||||
shell.Add(surface);
|
||||
|
||||
var actions = new VisualElement();
|
||||
actions.style.flexDirection = FlexDirection.Row;
|
||||
shell.Add(actions);
|
||||
|
||||
var back = new UnityEngine.UIElements.Button(() =>
|
||||
{
|
||||
HidePlayerSettingsSurface();
|
||||
ShowSettings();
|
||||
Fade(false);
|
||||
})
|
||||
{
|
||||
text = "Back"
|
||||
};
|
||||
actions.Add(back);
|
||||
}
|
||||
|
||||
private void HidePlayerSettingsSurface()
|
||||
{
|
||||
if (_playerSettingsSurfaceDocument == null)
|
||||
return;
|
||||
|
||||
_playerSettingsSurfaceDocument.rootVisualElement.Clear();
|
||||
_playerSettingsSurfaceDocument.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private UIDocument ResolvePlayerSettingsSurfaceDocument()
|
||||
{
|
||||
if (_playerSettingsSurfaceDocument != null)
|
||||
return _playerSettingsSurfaceDocument;
|
||||
|
||||
var host = new GameObject("Aetheria Player Settings Surface");
|
||||
host.transform.SetParent(transform, false);
|
||||
var document = host.AddComponent<UIDocument>();
|
||||
document.sortingOrder = 1000;
|
||||
host.SetActive(false);
|
||||
_playerSettingsSurfaceDocument = document;
|
||||
return document;
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceDocument BuildPlayerSettingsSurfaceDefinition()
|
||||
{
|
||||
return AetheriaRuntimePlayerSettingsSurfaceBuilder.Build(
|
||||
new AetheriaRuntimePlayerSettingsSurfaceState(
|
||||
ActionGameManager.RuntimePlayerSettings.Name,
|
||||
ActionGameManager.RuntimePlayerSettings.TutorialPassed,
|
||||
ActionGameManager.ContinueRunState?.RunId ?? "",
|
||||
ActionGameManager.RuntimePlayerSettings.GameplaySettings.TemperatureUnit.ToString(),
|
||||
max(0, ActionGameManager.RuntimePlayerSettings.GameplaySettings.SignificantDigits),
|
||||
ActionGameManager.RuntimePlayerSettings.GraphicsSettings.NebulaQuality.ToString(),
|
||||
ActionGameManager.RuntimePlayerSettings.GraphicsSettings.ShowAsteroidsInMinimap,
|
||||
DateTime.UtcNow.ToString("O")));
|
||||
}
|
||||
|
||||
private static EveSurfaceDocument ToEveSurfaceDocument(AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
return new EveSurfaceDocument(
|
||||
"surface-state",
|
||||
"gamecult.eve.surface.v1",
|
||||
document.ProviderId,
|
||||
document.ProviderKind,
|
||||
document.Title,
|
||||
document.Version,
|
||||
document.UpdatedAtUtc,
|
||||
new EveSurfaceTree(
|
||||
document.Surface.Id,
|
||||
ToEveSurfaceComponent(document.Surface.Root),
|
||||
document.Surface.Styles
|
||||
.Select(style => new EveStyleToken(style.Name, style.Value))
|
||||
.ToArray()),
|
||||
document.Commands
|
||||
.Select(command => new EveCommandTemplate(command.Command, command.Label, command.Transport))
|
||||
.ToArray());
|
||||
}
|
||||
|
||||
private static EveSurfaceComponent ToEveSurfaceComponent(AetheriaRuntimeSurfaceComponent component)
|
||||
{
|
||||
return new EveSurfaceComponent(
|
||||
component.Id,
|
||||
component.Kind,
|
||||
new Dictionary<string, string>(component.Props, StringComparer.Ordinal),
|
||||
component.Children.Select(ToEveSurfaceComponent).ToArray());
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_playerSettingsSurfaceDocument != null)
|
||||
{
|
||||
Destroy(_playerSettingsSurfaceDocument.gameObject);
|
||||
_playerSettingsSurfaceDocument = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
GameData/aetheria-world.cc.records/7085efa8330bccff7cb6c0417758d96439e6b9ef93f89095e0a409a1e7e06ee8.msgpack
(Stored with Git LFS)
Normal file
BIN
GameData/aetheria-world.cc.records/7085efa8330bccff7cb6c0417758d96439e6b9ef93f89095e0a409a1e7e06ee8.msgpack
(Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
GameData/aetheria-world.cc.records/7e27d6083d58a4e60a03d3c83653fa5b3c00f10d2ba3ba69869dc2b31b974368.msgpack
(Stored with Git LFS)
Normal file
BIN
GameData/aetheria-world.cc.records/7e27d6083d58a4e60a03d3c83653fa5b3c00f10d2ba3ba69869dc2b31b974368.msgpack
(Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
GameData/aetheria-world.cc.records/85a7f15cb90efeb97941396bd10dfca3b2b54a775f63e23ff9cf67dab7749478.msgpack
(Stored with Git LFS)
Normal file
BIN
GameData/aetheria-world.cc.records/85a7f15cb90efeb97941396bd10dfca3b2b54a775f63e23ff9cf67dab7749478.msgpack
(Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
GameData/aetheria-world.cc.records/8dab8568a223837c340cfff1eef539ab119b765806424fe8fdd96646d5820ba7.msgpack
(Stored with Git LFS)
Normal file
BIN
GameData/aetheria-world.cc.records/8dab8568a223837c340cfff1eef539ab119b765806424fe8fdd96646d5820ba7.msgpack
(Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue