fix: CameraOrbitKeyboard + playersAlive HUD

- CameraOrbitKeyboard: clic droit = unlock, clic gauche = re-lock (coherent avec PlayerController)
- CameraOrbitKeyboard: bloque les inputs quand ChatUI est ouvert
- CameraOrbitKeyboard: OnEnable ne verrouille plus la souris si un panel UI est ouvert
- NetworkManager: alimente GameHUD.SetPlayersAlive via Listen(playersAlive)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 08:25:25 +02:00
parent e2fa2ba8a9
commit a4792759e6
2 changed files with 9 additions and 6 deletions

View File

@@ -29,7 +29,9 @@ public class CameraOrbitKeyboard : MonoBehaviour
{
// On gère la souris nous-mêmes
if (_axisController != null) _axisController.enabled = false;
LockCursor();
// Only lock cursor if no UI panel is open
if (!ChatUI.IsVisible && !KeyBindingUI.IsVisible)
LockCursor();
}
void OnDisable()
@@ -55,16 +57,16 @@ public class CameraOrbitKeyboard : MonoBehaviour
var mouse = Mouse.current;
// Clic droit = toggle lock
if (mouse != null && mouse.rightButton.wasPressedThisFrame)
// Right-click unlocks, left-click re-locks (consistent with PlayerController)
if (!ChatUI.IsVisible && !KeyBindingUI.IsVisible && mouse != null)
{
if (Cursor.lockState == CursorLockMode.Locked)
if (Cursor.lockState == CursorLockMode.Locked && mouse.rightButton.wasPressedThisFrame)
UnlockCursor();
else
else if (Cursor.lockState != CursorLockMode.Locked && mouse.leftButton.wasPressedThisFrame)
LockCursor();
}
if (KeyBindingUI.IsVisible) return;
if (KeyBindingUI.IsVisible || ChatUI.IsVisible) return;
// Souris — seulement quand locked (delta infini, sans accrochage au bord)
if (Cursor.lockState == CursorLockMode.Locked && mouse != null)