Strip debug logging from the game, fix screen weirdness

This commit is contained in:
Michal Pikulski
2025-10-14 15:53:58 +02:00
parent 18be597424
commit e8180b21bf
65 changed files with 768 additions and 411 deletions

View File

@@ -4,7 +4,8 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using AppleHills.Core.Settings; // Added for IInteractionSettings
using AppleHills.Core.Settings;
using Core; // Added for IInteractionSettings
namespace Input
{
@@ -89,12 +90,12 @@ namespace Input
{
if (sceneName.ToLower().Contains("mainmenu"))
{
Debug.Log("[InputManager] SwitchInputOnSceneLoaded - Setting InputMode to UI for MainMenu");
Logging.Debug("[InputManager] SwitchInputOnSceneLoaded - Setting InputMode to UI for MainMenu");
SetInputMode(InputMode.GameAndUI);
}
else
{
Debug.Log("[InputManager] SwitchInputOnSceneLoaded - Setting InputMode to PlayerTouch");
Logging.Debug("[InputManager] SwitchInputOnSceneLoaded - Setting InputMode to PlayerTouch");
SetInputMode(InputMode.GameAndUI);
}
}
@@ -165,24 +166,24 @@ namespace Input
Vector2 screenPos = positionAction.ReadValue<Vector2>();
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
Debug.Log($"[InputManager] TapMove performed at {worldPos2D}");
Logging.Debug($"[InputManager] TapMove performed at {worldPos2D}");
// First try to delegate to an override consumer if available
if (TryDelegateToOverrideConsumer(screenPos, worldPos2D))
{
Debug.Log("[InputManager] Tap delegated to override consumer");
Logging.Debug("[InputManager] Tap delegated to override consumer");
return;
}
// Then try to delegate to any ITouchInputConsumer (UI or world interactable)
if (!TryDelegateToAnyInputConsumer(screenPos, worldPos2D))
{
Debug.Log("[InputManager] No input consumer found, forwarding tap to default consumer");
Logging.Debug("[InputManager] No input consumer found, forwarding tap to default consumer");
defaultConsumer?.OnTap(worldPos2D);
}
else
{
Debug.Log("[InputManager] Tap delegated to input consumer");
Logging.Debug("[InputManager] Tap delegated to input consumer");
}
}
@@ -195,13 +196,13 @@ namespace Input
Vector2 screenPos = positionAction.ReadValue<Vector2>();
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
Debug.Log($"[InputManager] HoldMove started at {worldPos2D}");
Logging.Debug($"[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}");
Logging.Debug($"[InputManager] Hold delegated to override consumer: {_activeHoldConsumer}");
_activeHoldConsumer.OnHoldStart(worldPos2D);
return;
}
@@ -221,7 +222,7 @@ namespace Input
Vector2 screenPos = positionAction.ReadValue<Vector2>();
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
Debug.Log($"[InputManager] HoldMove canceled at {worldPos2D}");
Logging.Debug($"[InputManager] HoldMove canceled at {worldPos2D}");
// Notify the active hold consumer that the hold has ended
_activeHoldConsumer?.OnHoldEnd(worldPos2D);
@@ -238,7 +239,7 @@ namespace Input
Vector2 screenPos = positionAction.ReadValue<Vector2>();
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
// Debug.Log($"[InputManager] HoldMove update at {worldPos2D}");
// Logging.Debug($"[InputManager] HoldMove update at {worldPos2D}");
// Send hold move updates to the active hold consumer
_activeHoldConsumer?.OnHoldMove(worldPos2D);
@@ -285,7 +286,7 @@ namespace Input
}
if (consumer != null)
{
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to UI consumer at {screenPos} (GameObject: {result.gameObject.name})");
Logging.Debug($"[InputManager] Delegating tap to UI consumer at {screenPos} (GameObject: {result.gameObject.name})");
consumer.OnTap(screenPos);
return true;
}
@@ -314,7 +315,7 @@ namespace Input
}
if (consumer != null)
{
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to consumer at {worldPos} (GameObject: {hitWithMask.gameObject.name})");
Logging.Debug($"[InputManager] Delegating tap to consumer at {worldPos} (GameObject: {hitWithMask.gameObject.name})");
consumer.OnTap(worldPos);
return true;
}
@@ -328,15 +329,15 @@ namespace Input
var consumer = hit.GetComponent<ITouchInputConsumer>();
if (consumer != null)
{
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to consumer at {worldPos} (GameObject: {hit.gameObject.name})");
Logging.Debug($"[InputManager] Delegating tap to consumer at {worldPos} (GameObject: {hit.gameObject.name})");
consumer.OnTap(worldPos);
return true;
}
Debug.unityLogger.Log("Interactable", $"[InputManager] Collider2D hit at {worldPos} (GameObject: {hit.gameObject.name}), but no ITouchInputConsumer found.");
Logging.Debug($"[InputManager] Collider2D hit at {worldPos} (GameObject: {hit.gameObject.name}), but no ITouchInputConsumer found.");
}
else
{
Debug.unityLogger.Log("Interactable", $"[InputManager] No Collider2D found at {worldPos} for interactable delegation.");
Logging.Debug($"[InputManager] No Collider2D found at {worldPos} for interactable delegation.");
}
return false;
}
@@ -351,7 +352,7 @@ namespace Input
return;
_overrideConsumers.Add(consumer);
Debug.Log($"[InputManager] Override consumer registered: {consumer}");
Logging.Debug($"[InputManager] Override consumer registered: {consumer}");
}
/// <summary>
@@ -369,7 +370,7 @@ namespace Input
}
_overrideConsumers.Remove(consumer);
Debug.Log($"[InputManager] Override consumer unregistered: {consumer}");
Logging.Debug($"[InputManager] Override consumer unregistered: {consumer}");
}
/// <summary>
@@ -379,7 +380,7 @@ namespace Input
{
_activeHoldConsumer = null;
_overrideConsumers.Clear();
Debug.Log("[InputManager] All override consumers cleared.");
Logging.Debug("[InputManager] All override consumers cleared.");
}
/// <summary>
@@ -392,7 +393,7 @@ namespace Input
// Get the topmost override consumer (last registered)
var consumer = _overrideConsumers[_overrideConsumers.Count - 1];
Debug.unityLogger.Log("Interactable", $"[InputManager] Delegating tap to override consumer at {worldPos} (GameObject: {consumer})");
Logging.Debug($"[InputManager] Delegating tap to override consumer at {worldPos} (GameObject: {consumer})");
consumer.OnTap(worldPos);
return true;
}