fix: chat PlayerName fallback + nouveau build WebGL 20260517b
- ChatUI: PlayerName utilise PlayerPrefs comme fallback si non connecte - NetworkManager: sauvegarde le nom dans PlayerPrefs a la connexion - GameCanvas: version build bump -> 20260517b (cache bust) - Nouveaux fichiers build_mai (data + wasm mis a jour) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -135,6 +135,8 @@ public class ChatUI : MonoBehaviour
|
||||
_inputText = GUILayout.TextField(_inputText, 200, ImGuiSkin.TextField, GUILayout.Height(28f));
|
||||
|
||||
bool canSend = !string.IsNullOrWhiteSpace(_inputText) && PlayerName.Length > 0;
|
||||
if (PlayerName.Length == 0)
|
||||
GUILayout.Label("Connectez-vous au jeu pour envoyer des messages.", ImGuiSkin.LabelDim);
|
||||
GUI.enabled = canSend;
|
||||
if (GUILayout.Button("Envoyer", ImGuiSkin.Button, GUILayout.Width(80f), GUILayout.Height(28f)))
|
||||
TrySend();
|
||||
@@ -171,7 +173,15 @@ public class ChatUI : MonoBehaviour
|
||||
|
||||
// ─── Send ────────────────────────────────────────────────────────────
|
||||
|
||||
private string PlayerName => NetworkManager.Instance?.LocalPlayerName ?? "";
|
||||
private string PlayerName
|
||||
{
|
||||
get
|
||||
{
|
||||
var nm = NetworkManager.Instance?.LocalPlayerName;
|
||||
if (!string.IsNullOrEmpty(nm)) return nm;
|
||||
return PlayerPrefs.GetString("rolld_player_name", "");
|
||||
}
|
||||
}
|
||||
|
||||
private void TrySend()
|
||||
{
|
||||
|
||||
2
game/Assets/Scripts/UI/ChatUI.cs.meta
Normal file
2
game/Assets/Scripts/UI/ChatUI.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: baad3cbcb6161a548ba18d5272ba57c5
|
||||
Reference in New Issue
Block a user