stash work
This commit is contained in:
@@ -36,22 +36,10 @@ namespace Input
|
||||
// Track which consumer is handling the current hold operation
|
||||
private ITouchInputConsumer _activeHoldConsumer;
|
||||
|
||||
public static InputManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null && Application.isPlaying && !_isQuitting)
|
||||
{
|
||||
_instance = FindAnyObjectByType<InputManager>();
|
||||
if (_instance == null)
|
||||
{
|
||||
var go = new GameObject("InputManager");
|
||||
_instance = go.AddComponent<InputManager>();
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Singleton instance of the InputManager. No longer creates an instance if one doesn't exist.
|
||||
/// </summary>
|
||||
public static InputManager Instance => _instance;
|
||||
|
||||
// Settings reference
|
||||
private IInteractionSettings _interactionSettings;
|
||||
@@ -67,6 +55,15 @@ namespace Input
|
||||
{
|
||||
_instance = this;
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to scene load completed events now that boot is complete
|
||||
SceneManagerService.Instance.SceneLoadCompleted += SwitchInputOnSceneLoaded;
|
||||
|
||||
// Initialize settings reference
|
||||
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
|
||||
|
||||
@@ -80,20 +77,16 @@ namespace Input
|
||||
holdMoveAction = playerInput.actions.FindAction("HoldMove", false);
|
||||
positionAction = playerInput.actions.FindAction("TouchPosition", false);
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// SceneManagerService subscription moved to InitializePostBoot
|
||||
if (tapMoveAction != null)
|
||||
tapMoveAction.performed += OnTapMovePerformed;
|
||||
if (holdMoveAction != null)
|
||||
{
|
||||
holdMoveAction.performed += OnHoldMoveStarted;
|
||||
holdMoveAction.canceled += OnHoldMoveCanceled;
|
||||
}
|
||||
|
||||
SwitchInputOnSceneLoaded(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to scene load completed events now that boot is complete
|
||||
SceneManagerService.Instance.SceneLoadCompleted += SwitchInputOnSceneLoaded;
|
||||
|
||||
Logging.Debug("[InputManager] Subscribed to SceneManagerService events");
|
||||
}
|
||||
|
||||
@@ -140,17 +133,6 @@ namespace Input
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (tapMoveAction != null)
|
||||
tapMoveAction.performed += OnTapMovePerformed;
|
||||
if (holdMoveAction != null)
|
||||
{
|
||||
holdMoveAction.performed += OnHoldMoveStarted;
|
||||
holdMoveAction.canceled += OnHoldMoveCanceled;
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user