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
|
// On gère la souris nous-mêmes
|
||||||
if (_axisController != null) _axisController.enabled = false;
|
if (_axisController != null) _axisController.enabled = false;
|
||||||
|
// Only lock cursor if no UI panel is open
|
||||||
|
if (!ChatUI.IsVisible && !KeyBindingUI.IsVisible)
|
||||||
LockCursor();
|
LockCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,16 +57,16 @@ public class CameraOrbitKeyboard : MonoBehaviour
|
|||||||
|
|
||||||
var mouse = Mouse.current;
|
var mouse = Mouse.current;
|
||||||
|
|
||||||
// Clic droit = toggle lock
|
// Right-click unlocks, left-click re-locks (consistent with PlayerController)
|
||||||
if (mouse != null && mouse.rightButton.wasPressedThisFrame)
|
if (!ChatUI.IsVisible && !KeyBindingUI.IsVisible && mouse != null)
|
||||||
{
|
{
|
||||||
if (Cursor.lockState == CursorLockMode.Locked)
|
if (Cursor.lockState == CursorLockMode.Locked && mouse.rightButton.wasPressedThisFrame)
|
||||||
UnlockCursor();
|
UnlockCursor();
|
||||||
else
|
else if (Cursor.lockState != CursorLockMode.Locked && mouse.leftButton.wasPressedThisFrame)
|
||||||
LockCursor();
|
LockCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyBindingUI.IsVisible) return;
|
if (KeyBindingUI.IsVisible || ChatUI.IsVisible) return;
|
||||||
|
|
||||||
// Souris — seulement quand locked (delta infini, sans accrochage au bord)
|
// Souris — seulement quand locked (delta infini, sans accrochage au bord)
|
||||||
if (Cursor.lockState == CursorLockMode.Locked && mouse != null)
|
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.OnRemove(state => state.players, (key, player) => OnPlayerRemove(key, player));
|
||||||
_callbacks.Listen(state => state.phase, (v, _) => _OnPhaseChanged(v));
|
_callbacks.Listen(state => state.phase, (v, _) => _OnPhaseChanged(v));
|
||||||
_callbacks.Listen(state => state.countdown, (v, _) => OnCountdownChanged?.Invoke(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<EliminatedMsg>("eliminated", msg => { OnEliminated?.Invoke(msg.sessionId, msg.reason); });
|
||||||
_room.OnMessage<QualifiedMsg> ("qualified", msg => { OnQualified?.Invoke(msg.sessionId); });
|
_room.OnMessage<QualifiedMsg> ("qualified", msg => { OnQualified?.Invoke(msg.sessionId); });
|
||||||
|
|||||||
Reference in New Issue
Block a user