Add skip functionality to Cinematics Manager
This commit is contained in:
@@ -31,6 +31,9 @@ namespace Input
|
||||
// Override consumer stack - using a list to support multiple overrides that can be removed in LIFO order
|
||||
private readonly List<ITouchInputConsumer> _overrideConsumers = new List<ITouchInputConsumer>();
|
||||
|
||||
// Track which consumer is handling the current hold operation
|
||||
private ITouchInputConsumer _activeHoldConsumer;
|
||||
|
||||
public static InputManager Instance
|
||||
{
|
||||
get
|
||||
@@ -193,6 +196,18 @@ namespace Input
|
||||
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
|
||||
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
|
||||
Debug.Log($"[InputManager] HoldMove started at {worldPos2D}");
|
||||
|
||||
// First check for override consumers
|
||||
if (_overrideConsumers.Count > 0)
|
||||
{
|
||||
_activeHoldConsumer = _overrideConsumers[_overrideConsumers.Count - 1];
|
||||
Debug.Log($"[InputManager] Hold delegated to override consumer: {_activeHoldConsumer}");
|
||||
_activeHoldConsumer.OnHoldStart(worldPos2D);
|
||||
return;
|
||||
}
|
||||
|
||||
// If no override consumers, use default consumer
|
||||
_activeHoldConsumer = defaultConsumer;
|
||||
defaultConsumer?.OnHoldStart(worldPos2D);
|
||||
}
|
||||
|
||||
@@ -207,7 +222,10 @@ namespace Input
|
||||
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
|
||||
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
|
||||
Debug.Log($"[InputManager] HoldMove canceled at {worldPos2D}");
|
||||
defaultConsumer?.OnHoldEnd(worldPos2D);
|
||||
|
||||
// Notify the active hold consumer that the hold has ended
|
||||
_activeHoldConsumer?.OnHoldEnd(worldPos2D);
|
||||
_activeHoldConsumer = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -221,7 +239,9 @@ namespace Input
|
||||
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
|
||||
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
|
||||
// Debug.Log($"[InputManager] HoldMove update at {worldPos2D}");
|
||||
defaultConsumer?.OnHoldMove(worldPos2D);
|
||||
|
||||
// Send hold move updates to the active hold consumer
|
||||
_activeHoldConsumer?.OnHoldMove(worldPos2D);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +362,12 @@ namespace Input
|
||||
if (consumer == null || !_overrideConsumers.Contains(consumer))
|
||||
return;
|
||||
|
||||
// If this is the active hold consumer, reset it
|
||||
if (_activeHoldConsumer == consumer)
|
||||
{
|
||||
_activeHoldConsumer = null;
|
||||
}
|
||||
|
||||
_overrideConsumers.Remove(consumer);
|
||||
Debug.Log($"[InputManager] Override consumer unregistered: {consumer}");
|
||||
}
|
||||
@@ -351,6 +377,7 @@ namespace Input
|
||||
/// </summary>
|
||||
public void ClearOverrideConsumers()
|
||||
{
|
||||
_activeHoldConsumer = null;
|
||||
_overrideConsumers.Clear();
|
||||
Debug.Log("[InputManager] All override consumers cleared.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user