Lower player name through Eve settings surface

This commit is contained in:
Meta Vens 2026-06-16 19:45:39 +01:00
commit 65a5a56635
8 changed files with 111 additions and 38 deletions

View file

@ -116,10 +116,22 @@ public class ActionGameManager : MonoBehaviour
QueueRuntimePlayerSettingsCommit();
}
public static bool CommitRuntimePlayerSettingsCommand(string command)
public static bool CommitRuntimePlayerSettingsCommand(
string command,
IReadOnlyDictionary<string, string> payload = null)
{
switch (command)
{
case AetheriaRuntimePlayerSettingsCommands.SetPlayerName:
if (payload != null && payload.TryGetValue("value", out var playerName))
{
CommitRuntimePlayerName(playerName);
}
else
{
CommitRuntimePlayerName("");
}
return true;
case AetheriaRuntimePlayerSettingsCommands.CycleTemperatureUnit:
CommitRuntimeTemperatureUnit(
RuntimePlayerSettings.GameplaySettings.TemperatureUnit switch

View file

@ -338,37 +338,12 @@ public class MainMenu : MonoBehaviour
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))
if (!ActionGameManager.CommitRuntimePlayerSettingsCommand(request.Command, request.Payload))
{
Debug.LogWarning($"Unknown player-settings command: {request.Command}");
return;