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:
@@ -29,6 +29,8 @@ public class CameraOrbitKeyboard : MonoBehaviour
|
||||
{
|
||||
// On gère la souris nous-mêmes
|
||||
if (_axisController != null) _axisController.enabled = false;
|
||||
// Only lock cursor if no UI panel is open
|
||||
if (!ChatUI.IsVisible && !KeyBindingUI.IsVisible)
|
||||
LockCursor();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -154,6 +154,7 @@ public class NetworkManager : MonoBehaviour
|
||||
_callbacks.OnRemove(state => state.players, (key, player) => OnPlayerRemove(key, player));
|
||||
_callbacks.Listen(state => state.phase, (v, _) => _OnPhaseChanged(v));
|
||||
_callbacks.Listen(state => state.countdown, (v, _) => OnCountdownChanged?.Invoke(v));
|
||||
_callbacks.Listen(state => state.playersAlive, (v, _) => GameHUD.Instance?.SetPlayersAlive(v));
|
||||
|
||||
_room.OnMessage<EliminatedMsg>("eliminated", msg => { OnEliminated?.Invoke(msg.sessionId, msg.reason); });
|
||||
_room.OnMessage<QualifiedMsg> ("qualified", msg => { OnQualified?.Invoke(msg.sessionId); });
|
||||
|
||||
Reference in New Issue
Block a user