Add player names: settings persistence, replication, screen-space nameplates
- GameSettings: playerName field persisted in Settings.json - NetworkPlayerSetup: owner-written DisplayName NetworkVariable (seeded from settings on spawn, sanitized/truncated, live rename push) - PlayerNameField: binds the session panel name input to settings - PlayerNameplates: screen-space overlay labels above players with distance-based font scaling (clamped min/max), pooling, FP self-hide Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6db78397da
commit
0e7ce0c410
6 files changed
+252
No files matched your search
@@ -17,6 +17,7 @@ public static class GameSettings
|
||||
public int version = FileVersion;
|
||||
public float mouseSensitivity = global::MouseSensitivity.Default;
|
||||
public float masterVolume = global::MasterVolume.Default;
|
||||
public string playerName = "";
|
||||
}
|
||||
|
||||
private static Data _data;
|
||||
@@ -46,6 +47,19 @@ public static class GameSettings
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Display name shown above the avatar. Empty = per-spawn fallback ("Player <clientId>").</summary>
|
||||
public static string PlayerName
|
||||
{
|
||||
get => Store.playerName ?? "";
|
||||
set
|
||||
{
|
||||
string v = value == null ? "" : value.Trim();
|
||||
if (Store.playerName == v) return;
|
||||
Store.playerName = v;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private static Data Load()
|
||||
{
|
||||
string path = SavePath();
|
||||
|
||||
Reference in new issue
Block a user