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:
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -3,7 +3,7 @@ import { useState, useEffect, useCallback } from 'react'
|
|||||||
// Check if Unity build files exist
|
// Check if Unity build files exist
|
||||||
const UNITY_BUILD_PATH = '/unity-build/Build'
|
const UNITY_BUILD_PATH = '/unity-build/Build'
|
||||||
// Cache-busting version — update this after each Unity build
|
// Cache-busting version — update this after each Unity build
|
||||||
const UNITY_BUILD_VERSION = '20260517'
|
const UNITY_BUILD_VERSION = '20260517b'
|
||||||
const BUILD_PREFIX = 'build_mai'
|
const BUILD_PREFIX = 'build_mai'
|
||||||
const LOADER_URL = `${UNITY_BUILD_PATH}/${BUILD_PREFIX}.loader.js?v=${UNITY_BUILD_VERSION}`
|
const LOADER_URL = `${UNITY_BUILD_PATH}/${BUILD_PREFIX}.loader.js?v=${UNITY_BUILD_VERSION}`
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ public class NetworkManager : MonoBehaviour
|
|||||||
LastError = "";
|
LastError = "";
|
||||||
LocalPlayerName = playerName;
|
LocalPlayerName = playerName;
|
||||||
LocalPlayerColor = color;
|
LocalPlayerColor = color;
|
||||||
|
PlayerPrefs.SetString("rolld_player_name", playerName);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
8
game/Assets/Scripts/Stats.meta
Normal file
8
game/Assets/Scripts/Stats.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e9c4c0760bb30024293b8152d79c595e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2
game/Assets/Scripts/Stats/StatsTracker.cs.meta
Normal file
2
game/Assets/Scripts/Stats/StatsTracker.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f63c62c1f3656c644947907edfe2e07f
|
||||||
@@ -135,6 +135,8 @@ public class ChatUI : MonoBehaviour
|
|||||||
_inputText = GUILayout.TextField(_inputText, 200, ImGuiSkin.TextField, GUILayout.Height(28f));
|
_inputText = GUILayout.TextField(_inputText, 200, ImGuiSkin.TextField, GUILayout.Height(28f));
|
||||||
|
|
||||||
bool canSend = !string.IsNullOrWhiteSpace(_inputText) && PlayerName.Length > 0;
|
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;
|
GUI.enabled = canSend;
|
||||||
if (GUILayout.Button("Envoyer", ImGuiSkin.Button, GUILayout.Width(80f), GUILayout.Height(28f)))
|
if (GUILayout.Button("Envoyer", ImGuiSkin.Button, GUILayout.Width(80f), GUILayout.Height(28f)))
|
||||||
TrySend();
|
TrySend();
|
||||||
@@ -171,7 +173,15 @@ public class ChatUI : MonoBehaviour
|
|||||||
|
|
||||||
// ─── Send ────────────────────────────────────────────────────────────
|
// ─── 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()
|
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