Restructured for new direction.

This commit is contained in:
2026-05-12 12:01:09 +01:00
parent 0439b6c1d2
commit c203f836b1
1134 changed files with 125569 additions and 213519 deletions

View File

@@ -8,7 +8,6 @@ using BriarQueen.Framework.Managers.UI;
using BriarQueen.Framework.Services.Game;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
using VContainer;
namespace BriarQueen.Framework.Managers.Input
@@ -48,6 +47,7 @@ namespace BriarQueen.Framework.Managers.Input
private bool _initialized;
private bool _isPaused;
private bool _isAnyUIOpen;
private InputAction _pauseAction;
private InputAction _pointAction;
@@ -58,7 +58,7 @@ namespace BriarQueen.Framework.Managers.Input
private InputAction _nextItemAction;
private InputAction _previousItemAction;
private InputAction _virtualMouseAction;
private InputAction _submitAction;
private InputAction _submitAction;
private UICursorService _uiCursorService;
@@ -77,6 +77,8 @@ namespace BriarQueen.Framework.Managers.Input
public bool IsPaused => _isPaused;
public bool UsingControllerCursor => DeviceInputType != DeviceInputType.KeyboardAndMouse;
public string CurrentControlScheme => _playerInput?.currentControlScheme ?? string.Empty;
private void Awake()
{
@@ -109,6 +111,7 @@ namespace BriarQueen.Framework.Managers.Input
_eventCoordinator.Unsubscribe<UIToggleHudEvent>(OnHudStateChanged);
_eventCoordinator.Unsubscribe<ToggleCodexEvent>(OnCodexStateChanged);
_eventCoordinator.Unsubscribe<ToggleToolScreenEvent>(OnToolScreenStateChanged);
_eventCoordinator.Unsubscribe<UIStackChangedEvent>(OnUIStackChanged);
}
UnbindCoreInputs();
@@ -148,28 +151,18 @@ namespace BriarQueen.Framework.Managers.Input
return;
}
if (_playerInput.actions == null)
{
Debug.LogWarning("[InputManager] PlayerInput.actions is null");
return;
}
Debug.Log($"[InputManager] Current map before cache: {ActiveActionMap}");
CacheActions();
Debug.Log($"[InputManager] Point action: {_pointAction}");
Debug.Log($"[InputManager] Click action: {_clickAction}");
Debug.Log($"[InputManager] Virtual_Mouse action: {_virtualMouseAction}");
BindCoreInputs();
DeviceInputType = GetDeviceInputType(_playerInput);
ApplyCursorModeForCurrentScheme();
_initialized = true;
_eventCoordinator.Subscribe<UIToggleHudEvent>(OnHudStateChanged);
_eventCoordinator.Subscribe<ToggleCodexEvent>(OnCodexStateChanged);
_eventCoordinator.Subscribe<ToggleToolScreenEvent>(OnToolScreenStateChanged);
_eventCoordinator.Subscribe<UIStackChangedEvent>(OnUIStackChanged);
Debug.Log("[InputManager] Initialization complete");
_initialized = true;
}
private void CacheActions()
@@ -205,14 +198,12 @@ namespace BriarQueen.Framework.Managers.Input
{
if (_pointAction != null)
{
Debug.Log("[InputManager] Binding Point");
_pointAction.performed += OnPoint;
_pointAction.canceled += OnPoint;
}
else
{
Debug.LogWarning("[InputManager] Required action 'Point' not found.");
}
if (_virtualMouseAction != null)
@@ -223,53 +214,33 @@ namespace BriarQueen.Framework.Managers.Input
if (_pauseAction != null)
_pauseAction.performed += OnPause;
else
Debug.LogWarning("[InputManager] Action 'Pause' not found.");
if (_clickAction != null)
_clickAction.performed += OnClick;
else
Debug.LogWarning("[InputManager] Action 'Click' not found.");
if (_rightClickAction != null)
_rightClickAction.performed += OnRightClick;
else
Debug.LogWarning("[InputManager] Action 'Right_Click' not found.");
if (_hideHudAction != null)
_hideHudAction.performed += OnHideHUD;
else
Debug.LogWarning("[InputManager] Action 'Hide_HUD' not found.");
if (_codexAction != null)
_codexAction.performed += OnCodex;
else
Debug.LogWarning("[InputManager] Action 'Codex' not found.");
if (_openToolsAction != null)
_openToolsAction.performed += OnOpenTools;
else
Debug.LogWarning("[InputManager] Action 'Show_Tools' not found.");
if (_nextToolAction != null)
_nextToolAction.performed += OnNextToolClicked;
else
Debug.LogWarning("[InputManager] Action 'Next_Tool' not found.");
if (_previousToolAction != null)
_previousToolAction.performed += OnPreviousToolClicked;
else
Debug.LogWarning("[InputManager] Action 'Previous_Tool' not found.");
if (_nextItemAction != null)
_nextItemAction.performed += OnNextItemClicked;
else
Debug.LogWarning("[InputManager] Action 'Next_Item' not found.");
if (_previousItemAction != null)
_previousItemAction.performed += OnPreviousItemClicked;
else
Debug.LogWarning("[InputManager] Action 'Previous_Item' not found.");
if (_playerInput != null)
_playerInput.onControlsChanged += OnControlsChanged;
@@ -343,7 +314,7 @@ namespace BriarQueen.Framework.Managers.Input
}
private void OnControlsChanged(PlayerInput playerInput)
{ Debug.Log($"Controls changed. Scheme: {playerInput.currentControlScheme}");
{
DeviceInputType = GetDeviceInputType(playerInput);
ApplyCursorModeForCurrentScheme();
}
@@ -391,7 +362,7 @@ namespace BriarQueen.Framework.Managers.Input
{
if (_submitAction == null || callback == null)
return;
_submitAction.performed -= callback;
}
@@ -401,11 +372,6 @@ namespace BriarQueen.Framework.Managers.Input
return;
var action = GetCachedAction(actionName);
if (action == null)
{
Debug.LogWarning($"[InputManager] Action '{actionName}' not found.");
return;
}
action.performed -= callback;
action.performed += callback;
@@ -417,11 +383,6 @@ namespace BriarQueen.Framework.Managers.Input
return;
var action = GetCachedAction(actionName);
if (action == null)
{
Debug.LogWarning($"[InputManager] Action '{actionName}' not found.");
return;
}
action.performed -= callback;
}
@@ -471,18 +432,28 @@ namespace BriarQueen.Framework.Managers.Input
_toolScreenShown = evt.Shown;
}
private void OnUIStackChanged(UIStackChangedEvent evt)
{
_isAnyUIOpen = evt.AnyUIOpen;
_isPaused = evt.AnyUIOpen && _gameService != null && !_gameService.IsMainMenuSceneLoaded;
}
private void OnHideHUD(InputAction.CallbackContext ctx)
{
_hudHidden = !_hudHidden;
_eventCoordinator?.PublishImmediate(new UIToggleHudEvent(_hudHidden));
_eventCoordinator?.PublishImmediate(new UIToggleHudEvent(!_hudHidden));
}
private void OnPause(InputAction.CallbackContext ctx)
{
if(_gameService.IsMainMenuSceneLoaded)
var isMainMenu = _gameService != null && _gameService.IsMainMenuSceneLoaded;
if (isMainMenu || _isAnyUIOpen)
{
_eventCoordinator?.PublishImmediate(new UIBackRequestedEvent());
return;
_isPaused = !_isPaused;
}
_isPaused = true;
_eventCoordinator?.Publish(new PauseButtonClickedEvent());
}
@@ -556,5 +527,6 @@ namespace BriarQueen.Framework.Managers.Input
return null;
}
}
}
}
}