From 3ebbecc2773bd7dd1d56a0b6ccea0742a58bb66a Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Mon, 10 Nov 2025 13:03:36 +0100 Subject: [PATCH] Clean up logging --- .../Scripts/Cinematics/CinematicsManager.cs | 4 +- .../Core/Lifecycle/LifecycleManager.cs | 10 +- .../Core/Lifecycle/ManagedBehaviour.cs | 2 +- Assets/Scripts/Core/SaveLoad/AppleMachine.cs | 14 +-- .../Scripts/Core/SaveLoad/SaveLoadManager.cs | 2 +- .../Scripts/Core/SaveablePlayableDirector.cs | 8 +- .../soundBird_CanFly.cs | 5 +- Assets/Scripts/Interactions/Interactable.cs | 2 +- Assets/Scripts/Interactions/ItemSlot.cs | 24 ++--- Assets/Scripts/Interactions/Pickup.cs | 4 +- .../Interactions/SaveableInteractable.cs | 11 ++- Assets/Scripts/Levels/LevelSwitch.cs | 8 +- Assets/Scripts/Levels/MinigameSwitch.cs | 4 +- Assets/Scripts/PuzzleS/BirdGameStats.cs | 3 +- Assets/Scripts/PuzzleS/PuzzleManager.cs | 2 +- Assets/Scripts/Sound/AppleAudioSource.cs | 2 +- Assets/Scripts/Sound/AudioManager.cs | 22 ++--- Assets/Scripts/Sound/LevelAudioObject.cs | 5 +- .../Scripts/Sound/ProximitySoundReaction.cs | 5 +- Assets/Scripts/UI/CardSystem/AlbumCard.cs | 15 +-- Assets/Scripts/UI/CardSystem/AlbumViewPage.cs | 97 +++++++------------ Assets/Scripts/UI/CardSystem/BookTabButton.cs | 16 +-- .../UI/CardSystem/BoosterOpeningPage.cs | 89 ++++++++--------- .../Scripts/UI/CardSystem/BoosterPackGiver.cs | 3 +- .../Scripts/UI/CardSystem/CardAlbumOpener.cs | 5 +- Assets/Scripts/UI/CardSystem/CardDisplay.cs | 2 +- .../DragDrop/AlbumCardPlacementDraggable.cs | 42 ++------ .../UI/CardSystem/DragDrop/AlbumCardSlot.cs | 27 +++--- .../DragDrop/BoosterPackDraggable.cs | 7 +- Assets/Scripts/UI/CardSystem/FlippableCard.cs | 27 +++--- .../UI/CardSystem/MinigameBoosterGiver.cs | 13 +-- .../UI/CardSystem/SlotContainerHelper.cs | 9 +- .../UI/DragAndDrop/Core/DraggableObject.cs | 23 ++--- .../UI/DragAndDrop/Core/DraggableVisual.cs | 11 ++- Assets/Scripts/UI/HudMenuButton.cs | 5 +- Assets/Scripts/UI/ScrapbookController.cs | 2 +- Assets/Scripts/UI/Tutorial/DivingTutorial.cs | 2 +- Assets/Scripts/Utils/AppleHillsUtils.cs | 2 +- 38 files changed, 234 insertions(+), 300 deletions(-) diff --git a/Assets/Scripts/Cinematics/CinematicsManager.cs b/Assets/Scripts/Cinematics/CinematicsManager.cs index 45724195..99ae67b8 100644 --- a/Assets/Scripts/Cinematics/CinematicsManager.cs +++ b/Assets/Scripts/Cinematics/CinematicsManager.cs @@ -86,7 +86,7 @@ namespace Cinematics // If still null, try to add the component if (playableDirector == null) { - Debug.Log("[CinematicsManager] Could not find Playable Director on the PlayerHudManager"); + Logging.Debug("[CinematicsManager] Could not find Playable Director on the PlayerHudManager"); } } @@ -99,7 +99,7 @@ namespace Cinematics // If still null, return error if (_cinematicSprites == null) { - Debug.LogWarning("[CinematicsManager] No Image found for cinematics display. Cinematics may not display correctly."); + Logging.Warning("[CinematicsManager] No Image found for cinematics display. Cinematics may not display correctly."); } } diff --git a/Assets/Scripts/Core/Lifecycle/LifecycleManager.cs b/Assets/Scripts/Core/Lifecycle/LifecycleManager.cs index 2ac71c73..6eb1747b 100644 --- a/Assets/Scripts/Core/Lifecycle/LifecycleManager.cs +++ b/Assets/Scripts/Core/Lifecycle/LifecycleManager.cs @@ -27,7 +27,7 @@ namespace Core.Lifecycle { if (_instance != null) { - Debug.LogWarning("[LifecycleManager] Instance already exists"); + Logging.Warning("[LifecycleManager] Instance already exists"); return; } @@ -35,7 +35,7 @@ namespace Core.Lifecycle _instance = go.AddComponent(); DontDestroyOnLoad(go); - Debug.Log("[LifecycleManager] Instance created"); + Logging.Debug("[LifecycleManager] Instance created"); } #endregion @@ -85,7 +85,7 @@ namespace Core.Lifecycle } else if (_instance != this) { - Debug.LogWarning("[LifecycleManager] Duplicate instance detected. Destroying."); + Logging.Warning("[LifecycleManager] Duplicate instance detected. Destroying."); Destroy(gameObject); } } @@ -111,7 +111,7 @@ namespace Core.Lifecycle { if (component == null) { - Debug.LogWarning("[LifecycleManager] Attempted to register null component"); + Logging.Warning("[LifecycleManager] Attempted to register null component"); return; } @@ -655,7 +655,7 @@ namespace Core.Lifecycle { if (enableDebugLogging) { - Debug.Log($"[LifecycleManager] {message}"); + Logging.Debug($"[LifecycleManager] {message}"); } } diff --git a/Assets/Scripts/Core/Lifecycle/ManagedBehaviour.cs b/Assets/Scripts/Core/Lifecycle/ManagedBehaviour.cs index 5281424c..1d648b08 100644 --- a/Assets/Scripts/Core/Lifecycle/ManagedBehaviour.cs +++ b/Assets/Scripts/Core/Lifecycle/ManagedBehaviour.cs @@ -119,7 +119,7 @@ namespace Core.Lifecycle } else { - Debug.LogWarning($"[ManagedBehaviour] LifecycleManager not found for {gameObject.name}. Component will not receive lifecycle callbacks."); + Logging.Warning($"[ManagedBehaviour] LifecycleManager not found for {gameObject.name}. Component will not receive lifecycle callbacks."); } } diff --git a/Assets/Scripts/Core/SaveLoad/AppleMachine.cs b/Assets/Scripts/Core/SaveLoad/AppleMachine.cs index 18479b37..4f4e606c 100644 --- a/Assets/Scripts/Core/SaveLoad/AppleMachine.cs +++ b/Assets/Scripts/Core/SaveLoad/AppleMachine.cs @@ -88,7 +88,7 @@ namespace Core.SaveLoad } else { - Debug.LogWarning($"[AppleMachine] SaveLoadManager not available for '{name}'", this); + Logging.Warning($"[AppleMachine] SaveLoadManager not available for '{name}'"); } } @@ -98,7 +98,7 @@ namespace Core.SaveLoad // Optional: Log the auto-generated ID in verbose mode if (verbose && string.IsNullOrEmpty(customSaveId)) { - Debug.Log($"[SaveableStateMachine] '{name}' will use auto-generated Save ID: {GetSaveId()}", this); + Logging.Debug($"[SaveableStateMachine] '{name}' will use auto-generated Save ID: {GetSaveId()}"); } } #endif @@ -158,7 +158,7 @@ namespace Core.SaveLoad { if (verbose) { - Debug.LogWarning($"[SaveableStateMachine] No data to restore for '{name}'", this); + Logging.Warning($"[SaveableStateMachine] No data to restore for '{name}'"); } return; } @@ -171,7 +171,7 @@ namespace Core.SaveLoad { if (verbose) { - Debug.LogWarning($"[SaveableStateMachine] No state name in save data for '{name}'", this); + Logging.Warning($"[SaveableStateMachine] No state name in save data for '{name}'"); } return; } @@ -197,7 +197,7 @@ namespace Core.SaveLoad if (verbose) { - Debug.Log($"[SaveableStateMachine] Restored '{name}' to state: {saveData.stateName}", this); + Logging.Debug($"[SaveableStateMachine] Restored '{name}' to state: {saveData.stateName}"); } } catch (System.Exception ex) @@ -215,14 +215,14 @@ namespace Core.SaveLoad [ContextMenu("Log Save ID")] private void LogSaveId() { - Debug.Log($"Save ID: {GetSaveId()}", this); + Logging.Debug($"Save ID: {GetSaveId()}"); } [ContextMenu("Test Serialize")] private void TestSerialize() { string serialized = SerializeState(); - Debug.Log($"Serialized state: {serialized}", this); + Logging.Debug($"Serialized state: {serialized}"); } #endif diff --git a/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs b/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs index 86a8ed76..4e7d49e1 100644 --- a/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs +++ b/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs @@ -717,7 +717,7 @@ namespace Core.SaveLoad { IsSaving = false; OnSaveCompleted?.Invoke(slot); - Debug.Log($"[SaveLoadManager] Save completed for slot '{slot}'"); + Logging.Debug($"[SaveLoadManager] Save completed for slot '{slot}'"); } } diff --git a/Assets/Scripts/Core/SaveablePlayableDirector.cs b/Assets/Scripts/Core/SaveablePlayableDirector.cs index fbbadc3f..0896fb5f 100644 --- a/Assets/Scripts/Core/SaveablePlayableDirector.cs +++ b/Assets/Scripts/Core/SaveablePlayableDirector.cs @@ -81,7 +81,7 @@ namespace Core { if (string.IsNullOrEmpty(serializedData)) { - Debug.LogWarning($"[SaveablePlayableDirector] No save data to restore for {gameObject.name}"); + Logging.Warning($"[SaveablePlayableDirector] No save data to restore for {gameObject.name}"); return; } @@ -99,7 +99,7 @@ namespace Core _director.time = _director.duration; _director.Evaluate(); // Force evaluation to apply the state - Debug.Log($"[SaveablePlayableDirector] Restored completed timeline '{gameObject.name}' - seeked to end"); + Logging.Debug($"[SaveablePlayableDirector] Restored completed timeline '{gameObject.name}' - seeked to end"); } else if (_hasPlayed && saveData.playbackTime > 0) { @@ -107,7 +107,7 @@ namespace Core _director.time = saveData.playbackTime; _director.Evaluate(); - Debug.Log($"[SaveablePlayableDirector] Restored timeline '{gameObject.name}' at time {saveData.playbackTime}"); + Logging.Debug($"[SaveablePlayableDirector] Restored timeline '{gameObject.name}' at time {saveData.playbackTime}"); } else { @@ -115,7 +115,7 @@ namespace Core _director.time = 0; _director.Evaluate(); - Debug.Log($"[SaveablePlayableDirector] Timeline '{gameObject.name}' not yet played - at start"); + Logging.Debug($"[SaveablePlayableDirector] Timeline '{gameObject.name}' not yet played - at start"); } } diff --git a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_CanFly.cs b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_CanFly.cs index 0193018a..aafe61db 100644 --- a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_CanFly.cs +++ b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_CanFly.cs @@ -1,3 +1,4 @@ +using Core; using UnityEngine; using Core.Lifecycle; @@ -35,7 +36,7 @@ public class soundBird_CanFly : ManagedBehaviour { if (string.IsNullOrEmpty(serializedData)) { - Debug.LogWarning($"[soundBird_CanFly] No save data to restore for {gameObject.name}"); + Logging.Warning($"[soundBird_CanFly] No save data to restore for {gameObject.name}"); return; } @@ -43,7 +44,7 @@ public class soundBird_CanFly : ManagedBehaviour if (saveData != null) { canFly = saveData.canFly; - Debug.Log($"[soundBird_CanFly] Restored canFly state: {canFly}"); + Logging.Debug($"[soundBird_CanFly] Restored canFly state: {canFly}"); } } diff --git a/Assets/Scripts/Interactions/Interactable.cs b/Assets/Scripts/Interactions/Interactable.cs index 5d504f36..48eab9f7 100644 --- a/Assets/Scripts/Interactions/Interactable.cs +++ b/Assets/Scripts/Interactions/Interactable.cs @@ -190,7 +190,7 @@ namespace Interactions /// True if interaction succeeded, false otherwise protected virtual bool DoInteraction() { - Debug.LogWarning($"[Interactable] DoInteraction not implemented for {GetType().Name}"); + Logging.Warning($"[Interactable] DoInteraction not implemented for {GetType().Name}"); return false; } diff --git a/Assets/Scripts/Interactions/ItemSlot.cs b/Assets/Scripts/Interactions/ItemSlot.cs index 28a27574..05c37883 100644 --- a/Assets/Scripts/Interactions/ItemSlot.cs +++ b/Assets/Scripts/Interactions/ItemSlot.cs @@ -333,7 +333,7 @@ namespace Interactions ItemSlotSaveData data = JsonUtility.FromJson(serializedData); if (data == null) { - Debug.LogWarning($"[ItemSlot] Failed to deserialize save data for {gameObject.name}"); + Logging.Warning($"[ItemSlot] Failed to deserialize save data for {gameObject.name}"); return; } @@ -343,7 +343,7 @@ namespace Interactions // Restore slotted item if there was one if (!string.IsNullOrEmpty(data.slottedItemSaveId)) { - Debug.Log($"[ItemSlot] Restoring slotted item: {data.slottedItemSaveId} (itemId: {data.slottedItemDataId})"); + Logging.Debug($"[ItemSlot] Restoring slotted item: {data.slottedItemSaveId} (itemId: {data.slottedItemDataId})"); RestoreSlottedItem(data.slottedItemSaveId, data.slottedItemDataId); } } @@ -361,7 +361,7 @@ namespace Interactions { // Item not found in scene - it might be a dynamically spawned combined item // Try to spawn it from the itemDataId - Debug.Log($"[ItemSlot] Slotted item not found in scene: {slottedItemSaveId}, attempting to spawn from itemId: {expectedItemDataId}"); + Logging.Debug($"[ItemSlot] Slotted item not found in scene: {slottedItemSaveId}, attempting to spawn from itemId: {expectedItemDataId}"); GameObject prefab = interactionSettings?.FindPickupPrefabByItemId(expectedItemDataId); if (prefab != null) @@ -369,17 +369,17 @@ namespace Interactions // Spawn the item (inactive, since it will be slotted) slottedObject = Instantiate(prefab, transform.position, Quaternion.identity); slottedObject.SetActive(false); - Debug.Log($"[ItemSlot] Successfully spawned combined item for slot: {expectedItemDataId}"); + Logging.Debug($"[ItemSlot] Successfully spawned combined item for slot: {expectedItemDataId}"); } else { - Debug.LogWarning($"[ItemSlot] Could not find prefab for itemId: {expectedItemDataId}"); + Logging.Warning($"[ItemSlot] Could not find prefab for itemId: {expectedItemDataId}"); return; } } else if (slottedObject == null) { - Debug.LogWarning($"[ItemSlot] Could not find slotted item with save ID: {slottedItemSaveId}"); + Logging.Warning($"[ItemSlot] Could not find slotted item with save ID: {slottedItemSaveId}"); return; } @@ -395,13 +395,13 @@ namespace Interactions { if (slottedData.itemId != expectedItemDataId) { - Debug.LogWarning($"[ItemSlot] ItemId mismatch! Pickup has '{slottedData.itemId}' but expected '{expectedItemDataId}'"); + Logging.Warning($"[ItemSlot] ItemId mismatch! Pickup has '{slottedData.itemId}' but expected '{expectedItemDataId}'"); } } if (slottedData == null) { - Debug.LogWarning($"[ItemSlot] Pickup {pickup.gameObject.name} has null itemData! Expected itemId: {expectedItemDataId}"); + Logging.Warning($"[ItemSlot] Pickup {pickup.gameObject.name} has null itemData! Expected itemId: {expectedItemDataId}"); if (slottedObject != null) Destroy(slottedObject); return; @@ -409,7 +409,7 @@ namespace Interactions } else { - Debug.LogWarning($"[ItemSlot] Slotted object has no Pickup component: {slottedObject.name}"); + Logging.Warning($"[ItemSlot] Slotted object has no Pickup component: {slottedObject.name}"); if (slottedObject != null) Destroy(slottedObject); return; @@ -419,7 +419,7 @@ namespace Interactions // Follower state is managed separately during save/load restoration ApplySlottedItemState(slottedObject, slottedData, triggerEvents: false); - Debug.Log($"[ItemSlot] Successfully restored slotted item: {slottedData.itemName} (itemId: {slottedData.itemId})"); + Logging.Debug($"[ItemSlot] Successfully restored slotted item: {slottedData.itemName} (itemId: {slottedData.itemId})"); } /// @@ -526,7 +526,7 @@ namespace Interactions // If slot already has an item, reject the claim if (currentlySlottedItemObject != null) { - Debug.LogWarning($"[ItemSlot] Already has a slotted item, rejecting claim from {pickup.gameObject.name}"); + Logging.Warning($"[ItemSlot] Already has a slotted item, rejecting claim from {pickup.gameObject.name}"); return false; } @@ -537,7 +537,7 @@ namespace Interactions // Claim the pickup ApplySlottedItemState(pickup.gameObject, pickup.itemData, triggerEvents: false); - Debug.Log($"[ItemSlot] Successfully claimed slotted item: {pickup.itemData?.itemName}"); + Logging.Debug($"[ItemSlot] Successfully claimed slotted item: {pickup.itemData?.itemName}"); return true; } diff --git a/Assets/Scripts/Interactions/Pickup.cs b/Assets/Scripts/Interactions/Pickup.cs index d4b9553f..58d5a19e 100644 --- a/Assets/Scripts/Interactions/Pickup.cs +++ b/Assets/Scripts/Interactions/Pickup.cs @@ -166,7 +166,7 @@ namespace Interactions PickupSaveData data = JsonUtility.FromJson(serializedData); if (data == null) { - Debug.LogWarning($"[Pickup] Failed to deserialize save data for {gameObject.name}"); + Logging.Warning($"[Pickup] Failed to deserialize save data for {gameObject.name}"); return; } @@ -200,7 +200,7 @@ namespace Interactions } else { - Debug.LogWarning($"[Pickup] Could not find slot with SaveId: {data.slotSaveId}"); + Logging.Warning($"[Pickup] Could not find slot with SaveId: {data.slotSaveId}"); } } } diff --git a/Assets/Scripts/Interactions/SaveableInteractable.cs b/Assets/Scripts/Interactions/SaveableInteractable.cs index d6c457c9..92026efd 100644 --- a/Assets/Scripts/Interactions/SaveableInteractable.cs +++ b/Assets/Scripts/Interactions/SaveableInteractable.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Core; +using UnityEngine; namespace Interactions { @@ -38,7 +39,7 @@ namespace Interactions { if (string.IsNullOrEmpty(serializedData)) { - Debug.LogWarning($"[SaveableInteractable] Empty save data for {SaveId}"); + Logging.Warning($"[SaveableInteractable] Empty save data for {SaveId}"); return; } @@ -85,17 +86,17 @@ namespace Interactions [ContextMenu("Log Save ID")] private void LogSaveId() { - Debug.Log($"Save ID: {SaveId}"); + Logging.Debug($"Save ID: {SaveId}"); } [ContextMenu("Test Serialize/Deserialize")] private void TestSerializeDeserialize() { string serialized = OnSceneSaveRequested(); - Debug.Log($"Serialized state: {serialized}"); + Logging.Debug($"Serialized state: {serialized}"); OnSceneRestoreRequested(serialized); - Debug.Log("Deserialization test complete"); + Logging.Debug("Deserialization test complete"); } #endif diff --git a/Assets/Scripts/Levels/LevelSwitch.cs b/Assets/Scripts/Levels/LevelSwitch.cs index 2bffef35..b4fa8972 100644 --- a/Assets/Scripts/Levels/LevelSwitch.cs +++ b/Assets/Scripts/Levels/LevelSwitch.cs @@ -25,7 +25,7 @@ namespace Levels { base.Awake(); - Debug.Log($"[LevelSwitch] Awake called for {gameObject.name} in scene {gameObject.scene.name}"); + Logging.Debug($"[LevelSwitch] Awake called for {gameObject.name} in scene {gameObject.scene.name}"); if (_iconRenderer == null) _iconRenderer = GetComponent(); @@ -38,12 +38,12 @@ namespace Levels protected override void OnManagedAwake() { - Debug.Log($"[LevelSwitch] OnManagedAwake called for {gameObject.name}"); + Logging.Debug($"[LevelSwitch] OnManagedAwake called for {gameObject.name}"); } protected override void OnSceneReady() { - Debug.Log($"[LevelSwitch] OnSceneReady called for {gameObject.name}"); + Logging.Debug($"[LevelSwitch] OnSceneReady called for {gameObject.name}"); } #if UNITY_EDITOR @@ -79,7 +79,7 @@ namespace Levels { if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName)) { - Debug.LogWarning("LevelSwitch has no valid switchData!"); + Logging.Warning("LevelSwitch has no valid switchData!"); return false; } diff --git a/Assets/Scripts/Levels/MinigameSwitch.cs b/Assets/Scripts/Levels/MinigameSwitch.cs index 05c5ab1b..53e3e7f6 100644 --- a/Assets/Scripts/Levels/MinigameSwitch.cs +++ b/Assets/Scripts/Levels/MinigameSwitch.cs @@ -160,7 +160,7 @@ namespace Levels { if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName)) { - Debug.LogWarning("MinigameSwitch has no valid switchData!"); + Logging.Warning("MinigameSwitch has no valid switchData!"); return false; } @@ -231,7 +231,7 @@ namespace Levels MinigameSwitchSaveData data = JsonUtility.FromJson(serializedData); if (data == null) { - Debug.LogWarning($"[MinigameSwitch] Failed to deserialize save data for {gameObject.name}"); + Logging.Warning($"[MinigameSwitch] Failed to deserialize save data for {gameObject.name}"); return; } diff --git a/Assets/Scripts/PuzzleS/BirdGameStats.cs b/Assets/Scripts/PuzzleS/BirdGameStats.cs index 4dff5880..25be834f 100644 --- a/Assets/Scripts/PuzzleS/BirdGameStats.cs +++ b/Assets/Scripts/PuzzleS/BirdGameStats.cs @@ -1,4 +1,5 @@ using System; +using Core; using Core.Lifecycle; using UnityEngine; @@ -55,7 +56,7 @@ namespace PuzzleS } catch (Exception ex) { - Debug.LogWarning($"[BirdGameStats] Failed to restore state: {ex.Message}"); + Logging.Warning($"[BirdGameStats] Failed to restore state: {ex.Message}"); } } diff --git a/Assets/Scripts/PuzzleS/PuzzleManager.cs b/Assets/Scripts/PuzzleS/PuzzleManager.cs index 12ac0610..d9e9f892 100644 --- a/Assets/Scripts/PuzzleS/PuzzleManager.cs +++ b/Assets/Scripts/PuzzleS/PuzzleManager.cs @@ -613,7 +613,7 @@ namespace PuzzleS protected override void OnSceneRestoreRequested(string data) { - Debug.Log("[XAXA] PuzzleManager loading with data: " + data); + Logging.Debug("[XAXA] PuzzleManager loading with data: " + data); if (string.IsNullOrEmpty(data) || data == "{}") { diff --git a/Assets/Scripts/Sound/AppleAudioSource.cs b/Assets/Scripts/Sound/AppleAudioSource.cs index 94d67caf..5eceabf9 100644 --- a/Assets/Scripts/Sound/AppleAudioSource.cs +++ b/Assets/Scripts/Sound/AppleAudioSource.cs @@ -75,7 +75,7 @@ public class AppleAudioSource : ManagedBehaviour } else { - Debug.Log("[AUDIOMANAGER] AppleAudioSource " + name + " was suppressed because something more important is playing"); + Logging.Debug("[AUDIOMANAGER] AppleAudioSource " + name + " was suppressed because something more important is playing"); } } else diff --git a/Assets/Scripts/Sound/AudioManager.cs b/Assets/Scripts/Sound/AudioManager.cs index ad648725..39ddb171 100644 --- a/Assets/Scripts/Sound/AudioManager.cs +++ b/Assets/Scripts/Sound/AudioManager.cs @@ -5,6 +5,7 @@ using AppleHills.Core.Interfaces; using System.Collections.Generic; using AudioSourceEvents; using System; +using Core; using Core.Lifecycle; public class AudioManager : ManagedBehaviour, IPausable @@ -71,16 +72,14 @@ public class AudioManager : ManagedBehaviour, IPausable } else { - Debug.LogWarning("[AudioManager] QuickAccess.Instance is null during OnManagedAwake. Some audio references may remain unset."); + Logging.Warning("[AudioManager] QuickAccess.Instance is null during OnManagedAwake. Some audio references may remain unset."); } // Diagnostic foreach (AppleAudioSource _audioSource in criticalVOSources) { - Debug.Log("Found source: " + _audioSource.name); + Logging.Debug("Found source: " + _audioSource.name); } - - Debug.Log("[AudioManager] OnManagedAwake completed"); } public void SetAudioPauseBehavior(PauseBehavior newPauseBehavior) @@ -104,15 +103,15 @@ public class AudioManager : ManagedBehaviour, IPausable public LevelAudioObject GetCurrentLevelAudioObject() { - Debug.Log("Audio objects: " + FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None).Length); + Logging.Debug("Audio objects: " + FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None).Length); if (FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None).Length > 1) { - Debug.LogWarning("Warning! More than one LevelAudioObject in the level! Using the first one found"); + Logging.Warning("Warning! More than one LevelAudioObject in the level! Using the first one found"); return FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None)[0]; } if (FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None).Length == 0) { - Debug.LogWarning("Error! No LevelAudioObject found, AudioManager might not function properly!"); + Logging.Warning("Error! No LevelAudioObject found, AudioManager might not function properly!"); return null; } else @@ -158,12 +157,10 @@ public class AudioManager : ManagedBehaviour, IPausable /// public bool RequestPlayVO(AppleAudioSource requestedAudioSource) { - //Debug.Log($"[AUDIOMANAGER] CurrentVO source prio: {currentlyPlayingVO.sourcePriority}, clip prio: {currentlyPlayingVO.clipPriority} requested VO prio: {requestedAudioSource.sourcePriority}, clip prio: {clipPriority}"); // If nothing is playing, let the requested audio source play if (currentlyPlayingVO == null) { SetupNewAudioSource(requestedAudioSource); - Debug.Log($"[AUDIOMANAGER] Playing {currentlyPlayingVO.name} as nothing is currently playing."); return true; } @@ -177,7 +174,6 @@ public class AudioManager : ManagedBehaviour, IPausable { InterruptAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource); - Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is the same as {requestedAudioSource.name}. Triggering it again."); return true; } @@ -187,7 +183,6 @@ public class AudioManager : ManagedBehaviour, IPausable InterruptAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource); - Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is not critical. Playing {requestedAudioSource.name} instead because it is critical."); return true; } // If the requested audio source has the same priority as currently playing source, check the priority of the requested clip @@ -197,8 +192,6 @@ public class AudioManager : ManagedBehaviour, IPausable { InterruptAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource); - Debug.Log($"[AUDIOMANAGER] Interrupted {currentlyPlayingVO.name} because it has same priority as {requestedAudioSource.name} but the requested clip has higher priority"); - return true; } else @@ -210,7 +203,6 @@ public class AudioManager : ManagedBehaviour, IPausable if (currentlyPlayingVO.audioSourceType == AppleAudioSource.AudioSourceType.CriticalVO && currentlyPlayingVO.sourcePriority > requestedAudioSource.sourcePriority) { currentlyPlayingVO.InterruptAudio(requestedAudioSource.name); - Debug.Log($"[AUDIOMANAGER] Interrupted {currentlyPlayingVO.name} because {requestedAudioSource.name} has higher priority"); InterruptAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource); return true; @@ -218,7 +210,6 @@ public class AudioManager : ManagedBehaviour, IPausable // If the requested audio source didn't clear any of the above cases, tell it to get rekt. else { - Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is still playing. {requestedAudioSource.name} has lower priority"); return false; } } @@ -232,7 +223,6 @@ public class AudioManager : ManagedBehaviour, IPausable { if (audioSource.audioSource.resource == null) { - Debug.Log($"[AUDIOMANAGER] Faled to setup {audioSource.name}. Invalid resource"); } else { diff --git a/Assets/Scripts/Sound/LevelAudioObject.cs b/Assets/Scripts/Sound/LevelAudioObject.cs index 23fab489..3bc2e341 100644 --- a/Assets/Scripts/Sound/LevelAudioObject.cs +++ b/Assets/Scripts/Sound/LevelAudioObject.cs @@ -1,6 +1,7 @@ using UnityEngine; using UnityEngine.Audio; using System; +using Core; using Core.Lifecycle; [Serializable] @@ -50,7 +51,7 @@ public class LevelAudioObject : ManagedBehaviour } catch (Exception e) { - Debug.LogWarning($"[LevelAudioObject] Failed to restore audio state: {e.Message}"); + Logging.Warning($"[LevelAudioObject] Failed to restore audio state: {e.Message}"); } } @@ -68,7 +69,7 @@ public class LevelAudioObject : ManagedBehaviour { if (narratorAudioSource == null || firstNarration == null) { - Debug.LogWarning($"[LevelAudioObject] Missing audio source or narration resource on {gameObject.name}"); + Logging.Warning($"[LevelAudioObject] Missing audio source or narration resource on {gameObject.name}"); return; } diff --git a/Assets/Scripts/Sound/ProximitySoundReaction.cs b/Assets/Scripts/Sound/ProximitySoundReaction.cs index 613a5aa3..fc9e9377 100644 --- a/Assets/Scripts/Sound/ProximitySoundReaction.cs +++ b/Assets/Scripts/Sound/ProximitySoundReaction.cs @@ -1,3 +1,4 @@ +using Core; using UnityEngine; public class ProximitySoundReaction : MonoBehaviour @@ -12,13 +13,13 @@ public class ProximitySoundReaction : MonoBehaviour private void OnCollisionEnter2D(Collision2D collision) { - Debug.Log("overlap!"); + Logging.Debug("overlap!"); } private void OnTriggerEnter2D(Collider2D collision) { - Debug.Log("Wolter triggered!"); + Logging.Debug("Wolter triggered!"); } diff --git a/Assets/Scripts/UI/CardSystem/AlbumCard.cs b/Assets/Scripts/UI/CardSystem/AlbumCard.cs index 65e99997..ca7e6e87 100644 --- a/Assets/Scripts/UI/CardSystem/AlbumCard.cs +++ b/Assets/Scripts/UI/CardSystem/AlbumCard.cs @@ -1,5 +1,6 @@ using System; using AppleHills.Data.CardSystem; +using Core; using Pixelplacement; using UnityEngine; using UnityEngine.EventSystems; @@ -82,37 +83,37 @@ namespace UI.CardSystem /// public void OnPointerClick(PointerEventData eventData) { - Debug.Log($"[CLICK-TRACE-ALBUMCARD] OnPointerClick on {name}, _parentSlot={((_parentSlot != null) ? _parentSlot.name : "NULL")}, _isEnlarged={_isEnlarged}, position={eventData.position}"); + Logging.Debug($"[CLICK-TRACE-ALBUMCARD] OnPointerClick on {name}, _parentSlot={((_parentSlot != null) ? _parentSlot.name : "NULL")}, _isEnlarged={_isEnlarged}, position={eventData.position}"); // During reveal flow (before placed in slot), forward clicks to parent FlippableCard if (_parentSlot == null) { - Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - No parent slot, forwarding click to parent FlippableCard"); + Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - No parent slot, forwarding click to parent FlippableCard"); // Find parent FlippableCard and forward the click FlippableCard parentFlippable = GetComponentInParent(); if (parentFlippable != null) { - Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Found parent FlippableCard, calling OnPointerClick"); + Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Found parent FlippableCard, calling OnPointerClick"); parentFlippable.OnPointerClick(eventData); } else { - Debug.LogWarning($"[CLICK-TRACE-ALBUMCARD] {name} - No parent FlippableCard found!"); + Logging.Warning($"[CLICK-TRACE-ALBUMCARD] {name} - No parent FlippableCard found!"); } return; } - Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Has parent slot, processing click"); + Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Has parent slot, processing click"); if (_isEnlarged) { - Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Is enlarged, requesting shrink"); + Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Is enlarged, requesting shrink"); OnShrinkRequested?.Invoke(this); } else { - Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Is normal size, requesting enlarge"); + Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Is normal size, requesting enlarge"); OnEnlargeRequested?.Invoke(this); } } diff --git a/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs b/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs index cd5d2b1b..5624fdbf 100644 --- a/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs +++ b/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs @@ -76,11 +76,11 @@ namespace UI.CardSystem if (book != null) { book.OnFlip.AddListener(OnPageFlipped); - Debug.Log("[AlbumViewPage] Subscribed to book.OnFlip event"); + Logging.Debug("[AlbumViewPage] Subscribed to book.OnFlip event"); } else { - Debug.LogWarning("[AlbumViewPage] Book reference is null, cannot subscribe to OnFlip event!"); + Logging.Warning("[AlbumViewPage] Book reference is null, cannot subscribe to OnFlip event!"); } // Subscribe to CardSystemManager events (managers are guaranteed to be initialized) @@ -116,15 +116,15 @@ namespace UI.CardSystem if (zoneTabs == null || zoneTabs.Length == 0) { - Debug.LogWarning($"[AlbumViewPage] No BookTabButton components found in tab container '{tabContainer.name}'!"); + Logging.Warning($"[AlbumViewPage] No BookTabButton components found in tab container '{tabContainer.name}'!"); zoneTabs = new BookTabButton[0]; } else { - Debug.Log($"[AlbumViewPage] Discovered {zoneTabs.Length} zone tabs from container '{tabContainer.name}'"); + Logging.Debug($"[AlbumViewPage] Discovered {zoneTabs.Length} zone tabs from container '{tabContainer.name}'"); foreach (var tab in zoneTabs) { - Debug.Log($" - Tab: {tab.name}, Zone: {tab.Zone}, TargetPage: {tab.TargetPage}"); + Logging.Debug($" - Tab: {tab.name}, Zone: {tab.Zone}, TargetPage: {tab.TargetPage}"); } } } @@ -209,7 +209,7 @@ namespace UI.CardSystem if (Input.InputManager.Instance != null) { Input.InputManager.Instance.SetInputMode(_previousInputMode); - Debug.Log($"[AlbumViewPage] Restored input mode to {_previousInputMode} on exit"); + Logging.Debug($"[AlbumViewPage] Restored input mode to {_previousInputMode} on exit"); } if (UIPageController.Instance != null) @@ -260,7 +260,7 @@ namespace UI.CardSystem // Store the current input mode before switching _previousInputMode = Input.InputMode.GameAndUI; Input.InputManager.Instance.SetInputMode(Input.InputMode.UI); - Debug.Log("[AlbumViewPage] Switched to UI-only input mode on first entry"); + Logging.Debug("[AlbumViewPage] Switched to UI-only input mode on first entry"); } // Subscribe to pending card events while page is active @@ -272,12 +272,12 @@ namespace UI.CardSystem // Only spawn pending cards if we're already on an album page (not the menu) if (IsInAlbumProper()) { - Debug.Log("[AlbumViewPage] Opening directly to album page - spawning cards immediately"); + Logging.Debug("[AlbumViewPage] Opening directly to album page - spawning cards immediately"); SpawnPendingCards(); } else { - Debug.Log("[AlbumViewPage] Opening to menu page - cards will spawn when entering album"); + Logging.Debug("[AlbumViewPage] Opening to menu page - cards will spawn when entering album"); } base.TransitionIn(); @@ -374,13 +374,12 @@ namespace UI.CardSystem { if (book == null) { - Debug.LogWarning("[AlbumViewPage] Book reference is null in IsInAlbumProper check"); + Logging.Warning("[AlbumViewPage] Book reference is null in IsInAlbumProper check"); return false; } // Page 1 is the menu/cover, page 2+ are album pages with card slots bool inAlbum = book.CurrentPaper > 1; - Debug.Log($"[PAGE-NAV-DEBUG] IsInAlbumProper check - CurrentPage: {book.CurrentPaper}, InAlbum: {inAlbum}"); return inAlbum; } @@ -390,24 +389,21 @@ namespace UI.CardSystem private void OnPageFlipped() { bool isInAlbum = IsInAlbumProper(); - - Debug.Log($"[PAGE-NAV-DEBUG] OnPageFlipped - CurrentPage: {book.CurrentPaper}, IsInAlbum: {isInAlbum}, CardsCurrentlySpawned: {_activeCards.Count}"); - if (isInAlbum && _activeCards.Count == 0) { // Entering album proper and no cards spawned yet - spawn them with animation - Debug.Log("[AlbumViewPage] Entering album proper - spawning pending cards with animation"); + Logging.Debug("[AlbumViewPage] Entering album proper - spawning pending cards with animation"); SpawnPendingCards(); } else if (!isInAlbum && _activeCards.Count > 0) { // Returning to menu page - cleanup cards - Debug.Log("[AlbumViewPage] Returning to menu page - cleaning up pending cards"); + Logging.Debug("[AlbumViewPage] Returning to menu page - cleaning up pending cards"); CleanupActiveCards(); } else { - Debug.Log($"[AlbumViewPage] Page flipped but no card state change needed (already in correct state)"); + Logging.Debug($"[AlbumViewPage] Page flipped but no card state change needed (already in correct state)"); } } @@ -434,7 +430,7 @@ namespace UI.CardSystem int spawnCount = Mathf.Min(uniquePending.Count, MAX_VISIBLE_CARDS); - Debug.Log($"[AlbumViewPage] Spawning {spawnCount} unique pending cards (total pending: {pending.Count})"); + Logging.Debug($"[AlbumViewPage] Spawning {spawnCount} unique pending cards (total pending: {pending.Count})"); for (int i = 0; i < spawnCount; i++) { @@ -450,14 +446,14 @@ namespace UI.CardSystem // Guard: Don't spawn cards with zero copies if (cardData.CopiesOwned <= 0) { - Debug.LogWarning($"[AlbumViewPage] Skipping spawn of card '{cardData.Name}' with {cardData.CopiesOwned} copies"); + Logging.Warning($"[AlbumViewPage] Skipping spawn of card '{cardData.Name}' with {cardData.CopiesOwned} copies"); return; } DraggableSlot slot = FindSlotByIndex(slotIndex); if (slot == null) { - Debug.LogWarning($"[AlbumViewPage] Could not find slot with SlotIndex {slotIndex}"); + Logging.Warning($"[AlbumViewPage] Could not find slot with SlotIndex {slotIndex}"); return; } @@ -484,11 +480,11 @@ namespace UI.CardSystem // Track it _activeCards.Add(cardPlacement); - Debug.Log($"[AlbumViewPage] Spawned card '{cardData.Name}' (CopiesOwned: {cardData.CopiesOwned}) in slot {slotIndex}"); + Logging.Debug($"[AlbumViewPage] Spawned card '{cardData.Name}' (CopiesOwned: {cardData.CopiesOwned}) in slot {slotIndex}"); } else { - Debug.LogWarning($"[AlbumViewPage] Spawned card has no AlbumCardDraggable component!"); + Logging.Warning($"[AlbumViewPage] Spawned card has no AlbumCardDraggable component!"); Destroy(cardObj); } } @@ -502,7 +498,7 @@ namespace UI.CardSystem // Guard: Don't spawn cards with zero copies if (card.CopiesOwned <= 0) { - Debug.LogWarning($"[AlbumViewPage] Ignoring pending card '{card.Name}' with {card.CopiesOwned} copies"); + Logging.Warning($"[AlbumViewPage] Ignoring pending card '{card.Name}' with {card.CopiesOwned} copies"); return; } @@ -513,7 +509,7 @@ namespace UI.CardSystem if (alreadySpawned) { - Debug.Log($"[AlbumViewPage] Card '{card.Name}' already spawned, skipping duplicate spawn"); + Logging.Debug($"[AlbumViewPage] Card '{card.Name}' already spawned, skipping duplicate spawn"); return; // Don't spawn duplicates } @@ -530,14 +526,13 @@ namespace UI.CardSystem /// private void OnCardRevealed(AlbumCardPlacementDraggable cardPlacement, CardData cardData) { - Debug.Log($"[AlbumViewPage] Card revealed: {cardData.Name} (Zone: {cardData.Zone}, CopiesOwned: {cardData.CopiesOwned})"); - Debug.Log($"[PAGE-NAV-DEBUG] OnCardRevealed - Card: {cardData.Name}, CardZone: {cardData.Zone}"); + Logging.Debug($"[AlbumViewPage] Card revealed: {cardData.Name} (Zone: {cardData.Zone}, CopiesOwned: {cardData.CopiesOwned})"); // IMMEDIATELY move card from pending to inventory upon reveal if (CardSystemManager.Instance != null) { CardSystemManager.Instance.MarkCardAsPlaced(cardData); - Debug.Log($"[AlbumViewPage] Moved card '{cardData.Name}' from pending to inventory on reveal"); + Logging.Debug($"[AlbumViewPage] Moved card '{cardData.Name}' from pending to inventory on reveal"); } // Remove this card from active cards list @@ -546,19 +541,15 @@ namespace UI.CardSystem // Check if we're currently viewing the correct zone for this card CardZone currentZone = GetCurrentZone(); - Debug.Log($"[PAGE-NAV-DEBUG] Zone comparison - CurrentZone: {currentZone}, CardZone: {cardData.Zone}, Match: {currentZone == cardData.Zone}"); - if (currentZone != cardData.Zone) { // Card is from a different zone - navigate to its zone - Debug.Log($"[AlbumViewPage] Card zone ({cardData.Zone}) doesn't match current zone ({currentZone}). Navigating to card's zone..."); - Debug.Log($"[PAGE-NAV-DEBUG] ZONE MISMATCH - Calling NavigateToZone({cardData.Zone})"); + Logging.Debug($"[AlbumViewPage] Card zone ({cardData.Zone}) doesn't match current zone ({currentZone}). Navigating to card's zone..."); NavigateToZone(cardData.Zone); } else { - Debug.Log($"[AlbumViewPage] Card zone ({cardData.Zone}) matches current zone - no navigation needed."); - Debug.Log($"[PAGE-NAV-DEBUG] Zones match - skipping navigation"); + Logging.Debug($"[AlbumViewPage] Card zone ({cardData.Zone}) matches current zone - no navigation needed."); } // Shuffle remaining cards to front and spawn next unique card @@ -573,7 +564,7 @@ namespace UI.CardSystem /// private void OnCardPlacedInAlbum(AlbumCardPlacementDraggable cardPlacement, CardData cardData) { - Debug.Log($"[AlbumViewPage] Card placed in album slot: {cardData.Name}"); + Logging.Debug($"[AlbumViewPage] Card placed in album slot: {cardData.Name}"); // Unsubscribe from events (card is now static in album) cardPlacement.OnCardRevealed -= OnCardRevealed; @@ -656,30 +647,22 @@ namespace UI.CardSystem /// public CardZone GetCurrentZone() { - Debug.Log($"[PAGE-NAV-DEBUG] GetCurrentZone() called"); - if (book == null || zoneTabs == null || zoneTabs.Length == 0) { - Debug.LogWarning($"[PAGE-NAV-DEBUG] GetCurrentZone - Missing references! book: {(book != null)}, zoneTabs: {(zoneTabs != null)}, zoneTabs.Length: {(zoneTabs != null ? zoneTabs.Length : 0)}"); return CardZone.AppleHills; // Default } int currentPage = book.CurrentPaper; - Debug.Log($"[PAGE-NAV-DEBUG] Current book page: {currentPage}"); // Find tab with matching target page foreach (var tab in zoneTabs) { - Debug.Log($"[PAGE-NAV-DEBUG] Checking tab - Zone: {tab.Zone}, TargetPage: {tab.TargetPage}"); if (tab.TargetPage == currentPage) { - Debug.Log($"[PAGE-NAV-DEBUG] Found matching tab! Zone: {tab.Zone}"); return tab.Zone; } } - // Fallback to first zone - Debug.LogWarning($"[PAGE-NAV-DEBUG] No tab matched current page {currentPage}, falling back to first zone: {CardZone.NotApplicable}"); return CardZone.NotApplicable; } @@ -688,27 +671,20 @@ namespace UI.CardSystem /// public BookTabButton GetTabForZone(CardZone zone) { - Debug.Log($"[PAGE-NAV-DEBUG] GetTabForZone({zone}) called"); if (zoneTabs == null) { - Debug.LogError($"[PAGE-NAV-DEBUG] zoneTabs is NULL! Cannot find tab for zone {zone}"); return null; } - Debug.Log($"[PAGE-NAV-DEBUG] Searching through {zoneTabs.Length} tabs for zone {zone}"); - foreach (var tab in zoneTabs) - { - Debug.Log($"[PAGE-NAV-DEBUG] Checking tab - Zone: {tab.Zone}, TargetPage: {tab.TargetPage}, Match: {tab.Zone == zone}"); + { if (tab.Zone == zone) { - Debug.Log($"[PAGE-NAV-DEBUG] FOUND matching tab for zone {zone}! TargetPage: {tab.TargetPage}"); return tab; } } - Debug.LogError($"[PAGE-NAV-DEBUG] NO TAB FOUND for zone {zone}! Navigation will fail."); return null; } @@ -717,18 +693,11 @@ namespace UI.CardSystem /// public void NavigateToZone(CardZone zone) { - Debug.Log($"[PAGE-NAV-DEBUG] NavigateToZone({zone}) called"); - BookTabButton tab = GetTabForZone(zone); if (tab != null) { - Debug.Log($"[PAGE-NAV-DEBUG] Tab found! Calling ActivateTab() on {tab.name}"); tab.ActivateTab(); } - else - { - Debug.LogError($"[PAGE-NAV-DEBUG] NAVIGATION FAILED - No tab found for zone {zone}!"); - } } /// @@ -782,7 +751,7 @@ namespace UI.CardSystem { if (card == null) return; - Debug.Log($"[AlbumViewPage] OnCardEnlargeRequested called for card: {card.name}, current parent: {card.transform.parent.name}"); + Logging.Debug($"[AlbumViewPage] OnCardEnlargeRequested called for card: {card.name}, current parent: {card.transform.parent.name}"); // IMPORTANT: Call EnlargeCard FIRST to store original parent (the slot) // BEFORE reparenting to the enlarged container @@ -792,7 +761,7 @@ namespace UI.CardSystem if (cardEnlargedBackdrop != null) { cardEnlargedBackdrop.SetActive(true); - Debug.Log($"[AlbumViewPage] Backdrop shown"); + Logging.Debug($"[AlbumViewPage] Backdrop shown"); } // NOW reparent card to enlarged container (above backdrop) @@ -800,10 +769,10 @@ namespace UI.CardSystem { card.transform.SetParent(cardEnlargedContainer, true); card.transform.SetAsLastSibling(); // Ensure on top - Debug.Log($"[AlbumViewPage] Card reparented to enlarged container"); + Logging.Debug($"[AlbumViewPage] Card reparented to enlarged container"); } - Debug.Log($"[AlbumViewPage] Card enlarged: {card.GetCardData()?.Name}"); + Logging.Debug($"[AlbumViewPage] Card enlarged: {card.GetCardData()?.Name}"); } /// @@ -831,7 +800,7 @@ namespace UI.CardSystem card.transform.localRotation = card.GetOriginalLocalRotation(); } - Debug.Log($"[AlbumViewPage] Card shrunk: {card.GetCardData()?.Name}"); + Logging.Debug($"[AlbumViewPage] Card shrunk: {card.GetCardData()?.Name}"); } /// @@ -842,7 +811,7 @@ namespace UI.CardSystem if (previewCardTransform == null) return; - Debug.Log($"[AlbumViewPage] ShowSlotPreview called for slot: {slot.name}"); + Logging.Debug($"[AlbumViewPage] ShowSlotPreview called for slot: {slot.name}"); // Show backdrop if (cardEnlargedBackdrop != null) @@ -866,7 +835,7 @@ namespace UI.CardSystem if (previewCardTransform == null) return; - Debug.Log($"[AlbumViewPage] HideSlotPreview called for slot: {slot.name}"); + Logging.Debug($"[AlbumViewPage] HideSlotPreview called for slot: {slot.name}"); // Hide backdrop if (cardEnlargedBackdrop != null) diff --git a/Assets/Scripts/UI/CardSystem/BookTabButton.cs b/Assets/Scripts/UI/CardSystem/BookTabButton.cs index 4650ddfa..4ecd9b4a 100644 --- a/Assets/Scripts/UI/CardSystem/BookTabButton.cs +++ b/Assets/Scripts/UI/CardSystem/BookTabButton.cs @@ -1,6 +1,7 @@ using System; using AppleHills.Data.CardSystem; using BookCurlPro; +using Core; using UnityEngine; using UnityEngine.UI; using Tween = Pixelplacement.Tween; @@ -67,17 +68,12 @@ namespace UI.CardSystem private void OnButtonClicked() { - Debug.Log($"[PAGE-NAV-DEBUG] BookTabButton.OnButtonClicked() - Tab: {gameObject.name}, Zone: {zone}, TargetPage: {targetPage}"); - if (book == null) { - Debug.LogWarning($"[BookTabButton] No BookPro reference assigned on {gameObject.name}"); - Debug.LogError($"[PAGE-NAV-DEBUG] BOOK REFERENCE IS NULL! Cannot flip page."); + Logging.Warning($"[BookTabButton] No BookPro reference assigned on {gameObject.name}"); return; } - Debug.Log($"[PAGE-NAV-DEBUG] Book reference valid. Current book page: {book.CurrentPaper}"); - // Notify all tabs that this one was clicked OnTabClicked?.Invoke(this); @@ -85,18 +81,11 @@ namespace UI.CardSystem BookCurlPro.AutoFlip autoFlip = book.GetComponent(); if (autoFlip == null) { - Debug.Log($"[PAGE-NAV-DEBUG] AutoFlip component not found, adding new component"); autoFlip = book.gameObject.AddComponent(); } - else - { - Debug.Log($"[PAGE-NAV-DEBUG] AutoFlip component found, enabled: {autoFlip.enabled}"); - } autoFlip.enabled = true; - Debug.Log($"[PAGE-NAV-DEBUG] Calling autoFlip.StartFlipping({targetPage})"); autoFlip.StartFlipping(targetPage); - Debug.Log($"[PAGE-NAV-DEBUG] Page flip initiated to page {targetPage}"); } private void OnAnyTabClicked(BookTabButton clickedTab) @@ -128,7 +117,6 @@ namespace UI.CardSystem // Public method to programmatically trigger this tab public void ActivateTab() { - Debug.Log($"[PAGE-NAV-DEBUG] ActivateTab() called on {gameObject.name} (Zone: {zone}, TargetPage: {targetPage})"); OnButtonClicked(); } diff --git a/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs b/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs index 0f26a181..2a9038f1 100644 --- a/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs +++ b/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using Pixelplacement; using UI.Core; @@ -68,7 +69,7 @@ namespace UI.CardSystem } else { - Debug.LogWarning("[BoosterOpeningPage] albumIcon does not have a Button component!"); + Logging.Warning("[BoosterOpeningPage] albumIcon does not have a Button component!"); } } @@ -111,7 +112,7 @@ namespace UI.CardSystem if (UIPageController.Instance != null) { UIPageController.Instance.PopPage(); - Debug.Log("[BoosterOpeningPage] Dismiss button clicked, popping page from stack"); + Logging.Debug("[BoosterOpeningPage] Dismiss button clicked, popping page from stack"); } } @@ -139,17 +140,17 @@ namespace UI.CardSystem /// private void InitializeBoosterDisplay() { - Debug.Log($"[BoosterOpeningPage] InitializeBoosterDisplay called with {_availableBoosterCount} boosters available"); + Logging.Debug($"[BoosterOpeningPage] InitializeBoosterDisplay called with {_availableBoosterCount} boosters available"); if (boosterPackPrefab == null) { - Debug.LogWarning("BoosterOpeningPage: No booster pack prefab assigned!"); + Logging.Warning("BoosterOpeningPage: No booster pack prefab assigned!"); return; } if (bottomRightSlots == null || bottomRightSlots.SlotCount == 0) { - Debug.LogWarning("BoosterOpeningPage: No slots available!"); + Logging.Warning("BoosterOpeningPage: No slots available!"); return; } @@ -159,7 +160,7 @@ namespace UI.CardSystem // Calculate how many boosters to show (max 3, or available count, whichever is lower) int visibleCount = Mathf.Min(_availableBoosterCount, MAX_VISIBLE_BOOSTERS); - Debug.Log($"[BoosterOpeningPage] Will spawn {visibleCount} boosters"); + Logging.Debug($"[BoosterOpeningPage] Will spawn {visibleCount} boosters"); // Spawn boosters and assign to slots for (int i = 0; i < visibleCount; i++) @@ -172,11 +173,11 @@ namespace UI.CardSystem { centerOpeningSlot.OnOccupied += OnBoosterPlacedInCenter; centerOpeningSlot.OnVacated += OnBoosterRemovedFromCenter; - Debug.Log($"[BoosterOpeningPage] Subscribed to center slot events"); + Logging.Debug($"[BoosterOpeningPage] Subscribed to center slot events"); } else { - Debug.LogWarning("[BoosterOpeningPage] centerOpeningSlot is null!"); + Logging.Warning("[BoosterOpeningPage] centerOpeningSlot is null!"); } } @@ -188,7 +189,7 @@ namespace UI.CardSystem DraggableSlot slot = FindSlotByIndex(slotIndex); if (slot == null) { - Debug.LogWarning($"[BoosterOpeningPage] Could not find slot with SlotIndex {slotIndex}!"); + Logging.Warning($"[BoosterOpeningPage] Could not find slot with SlotIndex {slotIndex}!"); return; } @@ -211,11 +212,11 @@ namespace UI.CardSystem // Track it _activeBoostersInSlots.Add(booster); - Debug.Log($"[BoosterOpeningPage] Spawned booster in slot with SlotIndex {slotIndex}"); + Logging.Debug($"[BoosterOpeningPage] Spawned booster in slot with SlotIndex {slotIndex}"); } else { - Debug.LogWarning($"[BoosterOpeningPage] Spawned booster has no BoosterPackDraggable component!"); + Logging.Warning($"[BoosterOpeningPage] Spawned booster has no BoosterPackDraggable component!"); Destroy(boosterObj); } } @@ -251,7 +252,7 @@ namespace UI.CardSystem booster.CurrentSlot.Vacate(); } - Debug.Log($"[BoosterOpeningPage] Removed booster from slot {slotIndex}"); + Logging.Debug($"[BoosterOpeningPage] Removed booster from slot {slotIndex}"); } _activeBoostersInSlots.RemoveAt(slotIndex); @@ -271,7 +272,7 @@ namespace UI.CardSystem RemoveBoosterFromSlot(lastIndex); } - Debug.Log($"[BoosterOpeningPage] Updated visible boosters: {_activeBoostersInSlots.Count}/{targetCount}"); + Logging.Debug($"[BoosterOpeningPage] Updated visible boosters: {_activeBoostersInSlots.Count}/{targetCount}"); } /// @@ -281,7 +282,7 @@ namespace UI.CardSystem { if (_activeBoostersInSlots.Count == 0) return; - Debug.Log($"[BoosterOpeningPage] Shuffling {_activeBoostersInSlots.Count} boosters to front slots"); + Logging.Debug($"[BoosterOpeningPage] Shuffling {_activeBoostersInSlots.Count} boosters to front slots"); // Unassign all boosters from their current slots foreach (var booster in _activeBoostersInSlots) @@ -301,12 +302,12 @@ namespace UI.CardSystem if (targetSlot != null) { - Debug.Log($"[BoosterOpeningPage] Assigning booster to slot with SlotIndex {i} {targetSlot.name}"); + Logging.Debug($"[BoosterOpeningPage] Assigning booster to slot with SlotIndex {i} {targetSlot.name}"); booster.AssignToSlot(targetSlot, true); // Animate the move } else { - Debug.LogWarning($"[BoosterOpeningPage] Could not find slot with SlotIndex {i} {targetSlot.name}"); + Logging.Warning($"[BoosterOpeningPage] Could not find slot with SlotIndex {i} {targetSlot.name}"); } } } @@ -351,7 +352,7 @@ namespace UI.CardSystem if (slot != null && !slot.IsOccupied) { SpawnBoosterInSlot(i); - Debug.Log($"[BoosterOpeningPage] Spawned new booster in slot with SlotIndex {i}"); + Logging.Debug($"[BoosterOpeningPage] Spawned new booster in slot with SlotIndex {i}"); break; } } @@ -374,16 +375,16 @@ namespace UI.CardSystem if (albumIcon != null) { albumIcon.SetActive(false); - Debug.Log($"[BoosterOpeningPage] Album icon hidden"); + Logging.Debug($"[BoosterOpeningPage] Album icon hidden"); } // Lock the slot so it can't be dragged out - Debug.Log($"[BoosterOpeningPage] Locking center slot. IsLocked before: {centerOpeningSlot.IsLocked}"); + Logging.Debug($"[BoosterOpeningPage] Locking center slot. IsLocked before: {centerOpeningSlot.IsLocked}"); centerOpeningSlot.SetLocked(true); - Debug.Log($"[BoosterOpeningPage] IsLocked after: {centerOpeningSlot.IsLocked}"); + Logging.Debug($"[BoosterOpeningPage] IsLocked after: {centerOpeningSlot.IsLocked}"); // Configure booster for opening (disables drag, enables tapping, resets tap count) - Debug.Log($"[BoosterOpeningPage] Calling SetInOpeningSlot(true) on booster"); + Logging.Debug($"[BoosterOpeningPage] Calling SetInOpeningSlot(true) on booster"); booster.SetInOpeningSlot(true); // Subscribe to tap events for visual feedback @@ -398,7 +399,7 @@ namespace UI.CardSystem // Shuffle remaining boosters to occupy the first slots ShuffleBoostersToFront(); - Debug.Log($"[BoosterOpeningPage] Booster placed in center, ready for taps. Active boosters in slots: {_activeBoostersInSlots.Count}"); + Logging.Debug($"[BoosterOpeningPage] Booster placed in center, ready for taps. Active boosters in slots: {_activeBoostersInSlots.Count}"); } /// @@ -417,12 +418,12 @@ namespace UI.CardSystem } _currentBoosterInCenter = null; - Debug.Log($"[BoosterOpeningPage] Booster removed from center"); + Logging.Debug($"[BoosterOpeningPage] Booster removed from center"); } private void OnBoosterTapped(BoosterPackDraggable booster, int currentTaps, int maxTaps) { - Debug.Log($"[BoosterOpeningPage] Booster tapped: {currentTaps}/{maxTaps}"); + Logging.Debug($"[BoosterOpeningPage] Booster tapped: {currentTaps}/{maxTaps}"); // Fire Cinemachine impulse with random velocity (excluding Z) if (impulseSource != null) @@ -447,7 +448,7 @@ namespace UI.CardSystem /// private void OnBoosterOpened(BoosterPackDraggable booster) { - Debug.Log($"[BoosterOpeningPage] Booster opened, playing particle effect"); + Logging.Debug($"[BoosterOpeningPage] Booster opened, playing particle effect"); // Reset and play particle system if (openingParticleSystem != null) @@ -485,7 +486,7 @@ namespace UI.CardSystem { if (_isProcessingOpening) return; - Debug.Log($"[BoosterOpeningPage] Booster ready to open!"); + Logging.Debug($"[BoosterOpeningPage] Booster ready to open!"); // Trigger the actual opening sequence booster.TriggerOpen(); @@ -528,7 +529,7 @@ namespace UI.CardSystem // WaitForCardReveals already includes: 0.5s wait + (cardCount * 0.5s stagger) + 0.5s animation + 0.5s final // Total is: 1.5s + (cardCount * 0.5s) // For 5 cards that's 4 seconds total, which should be enough - Debug.Log("[BoosterOpeningPage] Last booster opened, auto-transitioning to album main page"); + Logging.Debug("[BoosterOpeningPage] Last booster opened, auto-transitioning to album main page"); if (UIPageController.Instance != null) { UIPageController.Instance.PopPage(); @@ -575,7 +576,7 @@ namespace UI.CardSystem { if (flippableCardPrefab == null || cardDisplayContainer == null) { - Debug.LogWarning("BoosterOpeningPage: Missing card prefab or container!"); + Logging.Warning("BoosterOpeningPage: Missing card prefab or container!"); return; } @@ -619,7 +620,7 @@ namespace UI.CardSystem } else { - Debug.LogWarning($"[BoosterOpeningPage] FlippableCard component not found on card {i}!"); + Logging.Warning($"[BoosterOpeningPage] FlippableCard component not found on card {i}!"); } _currentRevealedCards.Add(cardObj); @@ -635,7 +636,7 @@ namespace UI.CardSystem /// private void OnCardFlipStarted(FlippableCard flippingCard) { - Debug.Log($"[BoosterOpeningPage] Card flip started, disabling all other cards."); + Logging.Debug($"[BoosterOpeningPage] Card flip started, disabling all other cards."); // Disable ALL cards immediately to prevent multi-flip foreach (GameObject cardObj in _currentRevealedCards) @@ -653,14 +654,14 @@ namespace UI.CardSystem /// private void OnCardRevealed(int cardIndex) { - Debug.Log($"[BoosterOpeningPage] Card {cardIndex} revealed!"); + Logging.Debug($"[BoosterOpeningPage] Card {cardIndex} revealed!"); _revealedCardCount++; // Get the flippable card and card data FlippableCard flippableCard = _currentRevealedCards[cardIndex].GetComponent(); if (flippableCard == null) { - Debug.LogWarning($"[BoosterOpeningPage] FlippableCard not found for card {cardIndex}!"); + Logging.Warning($"[BoosterOpeningPage] FlippableCard not found for card {cardIndex}!"); return; } @@ -671,7 +672,7 @@ namespace UI.CardSystem if (isNew) { - Debug.Log($"[BoosterOpeningPage] Card '{cardData.Name}' is NEW!"); + Logging.Debug($"[BoosterOpeningPage] Card '{cardData.Name}' is NEW!"); flippableCard.ShowAsNew(); } else @@ -679,7 +680,7 @@ namespace UI.CardSystem // Check if card is already Legendary - if so, skip progress bar and auto-progress if (existingCard.Rarity == AppleHills.Data.CardSystem.CardRarity.Legendary) { - Debug.Log($"[BoosterOpeningPage] Card '{cardData.Name}' is LEGENDARY - auto-progressing!"); + Logging.Debug($"[BoosterOpeningPage] Card '{cardData.Name}' is LEGENDARY - auto-progressing!"); // Add to inventory immediately and move to next card Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(cardData); _cardsCompletedInteraction++; @@ -689,14 +690,14 @@ namespace UI.CardSystem } int ownedCount = existingCard.CopiesOwned; - Debug.Log($"[BoosterOpeningPage] Card '{cardData.Name}' is a REPEAT! Owned: {ownedCount}"); + Logging.Debug($"[BoosterOpeningPage] Card '{cardData.Name}' is a REPEAT! Owned: {ownedCount}"); // Check if this card will trigger an upgrade (ownedCount + 1 >= threshold) bool willUpgrade = (ownedCount + 1) >= flippableCard.CardsToUpgrade && existingCard.Rarity < AppleHills.Data.CardSystem.CardRarity.Legendary; if (willUpgrade) { - Debug.Log($"[BoosterOpeningPage] This card will trigger upgrade! ({ownedCount + 1}/{flippableCard.CardsToUpgrade})"); + Logging.Debug($"[BoosterOpeningPage] This card will trigger upgrade! ({ownedCount + 1}/{flippableCard.CardsToUpgrade})"); // Show as repeat - progress bar will fill and auto-trigger upgrade flippableCard.ShowAsRepeatWithUpgrade(ownedCount, existingCard); } @@ -719,7 +720,7 @@ namespace UI.CardSystem /// private void OnCardCompletedInteraction(FlippableCard card, int cardIndex) { - Debug.Log($"[BoosterOpeningPage] Card {cardIndex} interaction complete!"); + Logging.Debug($"[BoosterOpeningPage] Card {cardIndex} interaction complete!"); // Add card to inventory NOW (after player saw it) Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(card.CardData); @@ -736,7 +737,7 @@ namespace UI.CardSystem // Re-enable all unrevealed cards (they can be flipped now) EnableUnrevealedCards(); - Debug.Log($"[BoosterOpeningPage] Cards completed interaction: {_cardsCompletedInteraction}/{_currentCardData.Length}"); + Logging.Debug($"[BoosterOpeningPage] Cards completed interaction: {_cardsCompletedInteraction}/{_currentCardData.Length}"); } /// @@ -757,7 +758,7 @@ namespace UI.CardSystem } } - Debug.Log($"[BoosterOpeningPage] Set active card. Only one card is now clickable."); + Logging.Debug($"[BoosterOpeningPage] Set active card. Only one card is now clickable."); } /// @@ -774,7 +775,7 @@ namespace UI.CardSystem } } - Debug.Log($"[BoosterOpeningPage] Re-enabled unrevealed cards for flipping."); + Logging.Debug($"[BoosterOpeningPage] Re-enabled unrevealed cards for flipping."); } /// @@ -782,7 +783,7 @@ namespace UI.CardSystem /// private void OnCardClickedWhileInactive(FlippableCard inactiveCard) { - Debug.Log($"[BoosterOpeningPage] Inactive card clicked, jiggling active card."); + Logging.Debug($"[BoosterOpeningPage] Inactive card clicked, jiggling active card."); if (_currentActiveCard != null) { @@ -801,7 +802,7 @@ namespace UI.CardSystem yield return null; } - Debug.Log($"[BoosterOpeningPage] All cards revealed! Waiting for interactions..."); + Logging.Debug($"[BoosterOpeningPage] All cards revealed! Waiting for interactions..."); // Wait until all cards have completed their new/repeat interaction while (_cardsCompletedInteraction < _currentCardData.Length) @@ -809,7 +810,7 @@ namespace UI.CardSystem yield return null; } - Debug.Log($"[BoosterOpeningPage] All interactions complete! Animating cards to album..."); + Logging.Debug($"[BoosterOpeningPage] All interactions complete! Animating cards to album..."); // All cards revealed and interacted with, wait a moment yield return new WaitForSeconds(0.5f); @@ -818,7 +819,7 @@ namespace UI.CardSystem if (albumIcon != null) { albumIcon.SetActive(true); - Debug.Log($"[BoosterOpeningPage] Album icon shown for card tween target"); + Logging.Debug($"[BoosterOpeningPage] Album icon shown for card tween target"); } // Animate cards to album icon (or center if no icon assigned) with staggered delays diff --git a/Assets/Scripts/UI/CardSystem/BoosterPackGiver.cs b/Assets/Scripts/UI/CardSystem/BoosterPackGiver.cs index 1f75394a..a65099cd 100644 --- a/Assets/Scripts/UI/CardSystem/BoosterPackGiver.cs +++ b/Assets/Scripts/UI/CardSystem/BoosterPackGiver.cs @@ -1,4 +1,5 @@ using System.Collections; +using Core; using Data.CardSystem; using UnityEngine; using UnityEngine.Events; @@ -58,7 +59,7 @@ namespace UI.CardSystem { if (Instance != null && Instance != this) { - Debug.LogWarning("[BoosterPackGiver] Duplicate instance detected. Destroying this component."); + Logging.Warning("[BoosterPackGiver] Duplicate instance detected. Destroying this component."); Destroy(this); yield break; } diff --git a/Assets/Scripts/UI/CardSystem/CardAlbumOpener.cs b/Assets/Scripts/UI/CardSystem/CardAlbumOpener.cs index a4884750..f894e439 100644 --- a/Assets/Scripts/UI/CardSystem/CardAlbumOpener.cs +++ b/Assets/Scripts/UI/CardSystem/CardAlbumOpener.cs @@ -1,4 +1,5 @@ -using UI.Core; +using Core; +using UI.Core; using UnityEngine; using UnityEngine.UI; @@ -46,7 +47,7 @@ namespace UI.CardSystem openAlbumButton.onClick.RemoveListener(OnOpenAlbumClicked); } - Debug.Log("ALBUM: CardAlbumDestroyed"); + Logging.Debug("ALBUM: CardAlbumDestroyed"); } private void OnOpenAlbumClicked() diff --git a/Assets/Scripts/UI/CardSystem/CardDisplay.cs b/Assets/Scripts/UI/CardSystem/CardDisplay.cs index a80f3baa..47e0589e 100644 --- a/Assets/Scripts/UI/CardSystem/CardDisplay.cs +++ b/Assets/Scripts/UI/CardSystem/CardDisplay.cs @@ -335,7 +335,7 @@ namespace UI.CardSystem { if (editorCardDefinition == null) { - UnityEngine.Debug.LogWarning("[CardDisplay] No Card Definition assigned in Editor Tools."); + Debug.LogWarning("[CardDisplay] No Card Definition assigned in Editor Tools."); return; } diff --git a/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardPlacementDraggable.cs b/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardPlacementDraggable.cs index 6550e542..6ea41899 100644 --- a/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardPlacementDraggable.cs +++ b/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardPlacementDraggable.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using Pixelplacement; using UI.DragAndDrop.Core; @@ -63,24 +64,15 @@ namespace UI.CardSystem /// public void RevealCard() { - Debug.Log($"[PAGE-NAV-DEBUG] RevealCard() called - _isRevealed: {_isRevealed}"); - if (_isRevealed) { - Debug.LogWarning($"[PAGE-NAV-DEBUG] Card already revealed, skipping reveal"); return; } - _isRevealed = true; - - Debug.Log($"[PAGE-NAV-DEBUG] Setting _isRevealed = true, card zone: {(_cardData != null ? _cardData.Zone.ToString() : "NULL")}"); - if (flippableCard != null) { flippableCard.FlipToReveal(); } - - Debug.Log($"[PAGE-NAV-DEBUG] Invoking OnCardRevealed event (subscribers: {(OnCardRevealed != null ? OnCardRevealed.GetInvocationList().Length : 0)})"); OnCardRevealed?.Invoke(this, _cardData); } @@ -91,7 +83,7 @@ namespace UI.CardSystem { if (_cardData == null) { - Debug.LogWarning("[AlbumCardPlacementDraggable] Cannot snap to slot - no card data assigned."); + Logging.Warning("[AlbumCardPlacementDraggable] Cannot snap to slot - no card data assigned."); return; } @@ -126,7 +118,7 @@ namespace UI.CardSystem TweenExtractedCardToSlot(extractedCard, () => { // After animation completes - Debug.Log($"[AlbumCardPlacementDraggable] Card placement animation complete for {_cardData.Name}"); + Logging.Debug($"[AlbumCardPlacementDraggable] Card placement animation complete for {_cardData.Name}"); // Notify that card was placed OnCardPlacedInAlbum?.Invoke(this, _cardData); @@ -137,13 +129,13 @@ namespace UI.CardSystem } else { - Debug.LogWarning("[AlbumCardPlacementDraggable] Failed to extract AlbumCard from wrapper!"); + Logging.Warning("[AlbumCardPlacementDraggable] Failed to extract AlbumCard from wrapper!"); } } } else { - Debug.LogWarning($"[AlbumCardPlacementDraggable] Could not find matching slot for card '{_cardData.Name}' (Zone: {_cardData.Zone}, Index: {_cardData.CollectionIndex})"); + Logging.Warning($"[AlbumCardPlacementDraggable] Could not find matching slot for card '{_cardData.Name}' (Zone: {_cardData.Zone}, Index: {_cardData.CollectionIndex})"); } } @@ -171,7 +163,7 @@ namespace UI.CardSystem Tween.LocalRotation(cardTransform, Quaternion.identity, snapDuration, 0f, Tween.EaseOutBack, completeCallback: () => { - Debug.Log($"[AlbumCardPlacementDraggable] Tween complete for extracted card {card.name}, final height: {cardRect.sizeDelta.y}"); + Logging.Debug($"[AlbumCardPlacementDraggable] Tween complete for extracted card {card.name}, final height: {cardRect.sizeDelta.y}"); onComplete?.Invoke(); }); } @@ -200,21 +192,16 @@ namespace UI.CardSystem protected override void OnPointerUpHook(bool longPress) { base.OnPointerUpHook(longPress); - - Debug.Log($"[CLICK-TRACE-PLACEMENT] OnPointerUpHook on {name}, _wasDragged={_wasDragged}, _isRevealed={_isRevealed}, _waitingForPlacementTap={_waitingForPlacementTap}, longPress={longPress}"); - _isHolding = false; // Cancel hold timer if running if (_holdRevealCoroutine != null) { - Debug.LogWarning($"[PAGE-NAV-DEBUG] OnPointerUpHook - CANCELLING HoldRevealTimer coroutine! Card was released before reveal completed."); StopCoroutine(_holdRevealCoroutine); _holdRevealCoroutine = null; } else { - Debug.Log($"[PAGE-NAV-DEBUG] OnPointerUpHook - No hold timer to cancel (either completed or never started)"); } // Handle tap (not dragged) @@ -222,34 +209,26 @@ namespace UI.CardSystem { if (!_isRevealed) { - Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - First tap, revealing card"); // First tap: reveal the card RevealCard(); _waitingForPlacementTap = true; } else if (_waitingForPlacementTap) { - Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Second tap, snapping to slot"); // Second tap: snap to slot _waitingForPlacementTap = false; SnapToAlbumSlot(); } else { - Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Tap after reveal but not waiting for placement tap"); } } else if (_isDragRevealing) { - Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Was drag-revealed, auto-snapping"); // Was drag-revealed, auto-snap on release _isDragRevealing = false; SnapToAlbumSlot(); } - else - { - Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Was dragged but no special handling"); - } } /// @@ -257,22 +236,13 @@ namespace UI.CardSystem /// private IEnumerator HoldRevealTimer() { - Debug.Log($"[PAGE-NAV-DEBUG] HoldRevealTimer started, waiting {holdRevealDelay}s..."); yield return new WaitForSeconds(holdRevealDelay); - Debug.Log($"[PAGE-NAV-DEBUG] HoldRevealTimer completed - _isRevealed: {_isRevealed}, _isHolding: {_isHolding}"); - // If still holding after delay, reveal the card if (!_isRevealed && _isHolding) { - Debug.Log($"[PAGE-NAV-DEBUG] Hold timer conditions met - calling RevealCard() for zone: {(_cardData != null ? _cardData.Zone.ToString() : "NULL")}"); RevealCard(); _isDragRevealing = true; - Debug.Log("[AlbumCardDraggable] Card revealed via hold"); - } - else - { - Debug.LogWarning($"[PAGE-NAV-DEBUG] Hold timer completed but conditions NOT met - _isRevealed: {_isRevealed}, _isHolding: {_isHolding}. Card will NOT reveal!"); } _holdRevealCoroutine = null; diff --git a/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs b/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs index 6c436591..2ef8810f 100644 --- a/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs +++ b/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs @@ -1,4 +1,5 @@ using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using UI.DragAndDrop.Core; using UnityEngine; @@ -133,7 +134,7 @@ namespace UI.CardSystem // Keep preview hidden - it'll show when user taps to enlarge previewCardDisplay.gameObject.SetActive(false); - Debug.Log($"[AlbumCardSlot] Setup preview card for {targetCardDefinition.Name} (hidden until tap)"); + Logging.Debug($"[AlbumCardSlot] Setup preview card for {targetCardDefinition.Name} (hidden until tap)"); } /// @@ -152,7 +153,7 @@ namespace UI.CardSystem // Guard: need prefab to spawn if (albumCardPrefab == null) { - Debug.LogWarning($"[AlbumCardSlot] No albumCardPrefab assigned for slot targeting {targetCardDefinition.name}"); + Logging.Warning($"[AlbumCardSlot] No albumCardPrefab assigned for slot targeting {targetCardDefinition.name}"); return; } @@ -213,11 +214,11 @@ namespace UI.CardSystem albumPage.RegisterAlbumCard(albumCard); } - Debug.Log($"[AlbumCardSlot] Spawned owned card '{cardData.Name}' ({cardData.Rarity}) in slot"); + Logging.Debug($"[AlbumCardSlot] Spawned owned card '{cardData.Name}' ({cardData.Rarity}) in slot"); } else { - Debug.LogWarning($"[AlbumCardSlot] Spawned prefab has no AlbumCard component!"); + Logging.Warning($"[AlbumCardSlot] Spawned prefab has no AlbumCard component!"); Destroy(cardObj); } } @@ -235,30 +236,30 @@ namespace UI.CardSystem /// public void OnPointerClick(PointerEventData eventData) { - Debug.Log($"[CLICK-TRACE-SLOT] OnPointerClick on {name}, _isOccupiedPermanently={_isOccupiedPermanently}, _placedCard={((_placedCard != null) ? _placedCard.name : "NULL")}, _isPreviewShowing={_isPreviewShowing}, position={eventData.position}"); + Logging.Debug($"[CLICK-TRACE-SLOT] OnPointerClick on {name}, _isOccupiedPermanently={_isOccupiedPermanently}, _placedCard={((_placedCard != null) ? _placedCard.name : "NULL")}, _isPreviewShowing={_isPreviewShowing}, position={eventData.position}"); // Only handle clicks if slot is empty if (_isOccupiedPermanently || _placedCard != null) { - Debug.Log($"[CLICK-TRACE-SLOT] {name} - Slot is occupied, ignoring"); + Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Slot is occupied, ignoring"); return; } // Only handle if we have a preview card setup if (previewCardDisplay == null || targetCardDefinition == null) { - Debug.Log($"[CLICK-TRACE-SLOT] {name} - No preview setup, ignoring"); + Logging.Debug($"[CLICK-TRACE-SLOT] {name} - No preview setup, ignoring"); return; } if (_isPreviewShowing) { - Debug.Log($"[CLICK-TRACE-SLOT] {name} - Preview is showing, hiding it"); + Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Preview is showing, hiding it"); HidePreview(); } else { - Debug.Log($"[CLICK-TRACE-SLOT] {name} - Preview is hidden, showing it"); + Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Preview is hidden, showing it"); ShowPreview(); } } @@ -293,7 +294,7 @@ namespace UI.CardSystem Pixelplacement.Tween.LocalScale(previewCardDisplay.transform, _previewOriginalScale * previewEnlargedScale, previewScaleDuration, 0f, Pixelplacement.Tween.EaseOutBack); - Debug.Log($"[AlbumCardSlot] Showing preview for {targetCardDefinition.Name}"); + Logging.Debug($"[AlbumCardSlot] Showing preview for {targetCardDefinition.Name}"); } /// @@ -340,11 +341,11 @@ namespace UI.CardSystem // Hide the preview card after returning to slot previewCardDisplay.gameObject.SetActive(false); - Debug.Log($"[AlbumCardSlot] Preview hidden and reset for {targetCardDefinition.Name}"); + Logging.Debug($"[AlbumCardSlot] Preview hidden and reset for {targetCardDefinition.Name}"); }); } - Debug.Log($"[AlbumCardSlot] Hiding preview for {targetCardDefinition.Name}"); + Logging.Debug($"[AlbumCardSlot] Hiding preview for {targetCardDefinition.Name}"); } /// @@ -352,7 +353,7 @@ namespace UI.CardSystem /// public void DismissPreview() { - Debug.Log($"[CLICK-TRACE-SLOT] DismissPreview called on {name}"); + Logging.Debug($"[CLICK-TRACE-SLOT] DismissPreview called on {name}"); HidePreview(); } diff --git a/Assets/Scripts/UI/CardSystem/DragDrop/BoosterPackDraggable.cs b/Assets/Scripts/UI/CardSystem/DragDrop/BoosterPackDraggable.cs index b348c05e..bf6527ab 100644 --- a/Assets/Scripts/UI/CardSystem/DragDrop/BoosterPackDraggable.cs +++ b/Assets/Scripts/UI/CardSystem/DragDrop/BoosterPackDraggable.cs @@ -1,4 +1,5 @@ -using UI.DragAndDrop.Core; +using Core; +using UI.DragAndDrop.Core; using UnityEngine; namespace UI.CardSystem.DragDrop @@ -127,10 +128,10 @@ namespace UI.CardSystem.DragDrop /// public void SetInOpeningSlot(bool inSlot) { - Debug.Log($"[BoosterPackDraggable] SetInOpeningSlot({inSlot}) called on {name}"); + Logging.Debug($"[BoosterPackDraggable] SetInOpeningSlot({inSlot}) called on {name}"); SetDraggingEnabled(!inSlot); // Disable dragging when in opening slot - Debug.Log($"[BoosterPackDraggable] SetDraggingEnabled({!inSlot}) called"); + Logging.Debug($"[BoosterPackDraggable] SetDraggingEnabled({!inSlot}) called"); canTapToOpen = inSlot; // Enable tap-to-open when in opening slot diff --git a/Assets/Scripts/UI/CardSystem/FlippableCard.cs b/Assets/Scripts/UI/CardSystem/FlippableCard.cs index 23d21399..8b31d610 100644 --- a/Assets/Scripts/UI/CardSystem/FlippableCard.cs +++ b/Assets/Scripts/UI/CardSystem/FlippableCard.cs @@ -1,5 +1,6 @@ using System; using AppleHills.Data.CardSystem; +using Core; using Pixelplacement; using Pixelplacement.TweenSystem; using UnityEngine; @@ -260,12 +261,12 @@ namespace UI.CardSystem public void OnPointerClick(PointerEventData eventData) { - Debug.Log($"[CLICK-TRACE-FLIPPABLE] OnPointerClick on {name}, _isClickable={_isClickable}, _isWaitingForTap={_isWaitingForTap}, _isFlipped={_isFlipped}, position={eventData.position}"); + Logging.Debug($"[CLICK-TRACE-FLIPPABLE] OnPointerClick on {name}, _isClickable={_isClickable}, _isWaitingForTap={_isWaitingForTap}, _isFlipped={_isFlipped}, position={eventData.position}"); // If not clickable, notify and return if (!_isClickable) { - Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Not clickable, firing OnClickedWhileInactive"); + Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Not clickable, firing OnClickedWhileInactive"); OnClickedWhileInactive?.Invoke(this); return; } @@ -273,7 +274,7 @@ namespace UI.CardSystem // If waiting for tap after reveal, handle that if (_isWaitingForTap) { - Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Waiting for tap, dismissing enlarged state"); + Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Waiting for tap, dismissing enlarged state"); OnCardTappedAfterReveal?.Invoke(this); _isWaitingForTap = false; return; @@ -281,11 +282,11 @@ namespace UI.CardSystem if (_isFlipped || _isFlipping) { - Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Ignoring click (flipped={_isFlipped}, flipping={_isFlipping})"); + Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Ignoring click (flipped={_isFlipped}, flipping={_isFlipping})"); return; } - Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Processing click, starting flip"); + Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Processing click, starting flip"); // Flip on click FlipToReveal(); } @@ -341,7 +342,7 @@ namespace UI.CardSystem /// private void TriggerUpgradeTransition(AppleHills.Data.CardSystem.CardData lowerRarityCard) { - Debug.Log($"[FlippableCard] Triggering upgrade transition from {lowerRarityCard.Rarity}!"); + Logging.Debug($"[FlippableCard] Triggering upgrade transition from {lowerRarityCard.Rarity}!"); AppleHills.Data.CardSystem.CardRarity oldRarity = lowerRarityCard.Rarity; AppleHills.Data.CardSystem.CardRarity newRarity = oldRarity + 1; @@ -429,7 +430,7 @@ namespace UI.CardSystem if (newCardText != null) newCardText.SetActive(true); - Debug.Log($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing as NEW."); + Logging.Debug($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing as NEW."); // Card is already enlarged from the repeat display, so no need to enlarge again } @@ -457,7 +458,7 @@ namespace UI.CardSystem TransitionToNewCardView(newRarity); }); - Debug.Log($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing progress {ownedAtNewRarity}/5"); + Logging.Debug($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing progress {ownedAtNewRarity}/5"); } /// @@ -465,7 +466,7 @@ namespace UI.CardSystem /// private void TransitionToNewCardView(AppleHills.Data.CardSystem.CardRarity newRarity) { - Debug.Log($"[FlippableCard] Transitioning to NEW CARD view at {newRarity} rarity"); + Logging.Debug($"[FlippableCard] Transitioning to NEW CARD view at {newRarity} rarity"); // Update the CardDisplay to show new rarity if (cardDisplay != null && _cardData != null) @@ -488,7 +489,7 @@ namespace UI.CardSystem _isNew = true; _isWaitingForTap = true; - Debug.Log($"[FlippableCard] Now showing as NEW CARD at {newRarity}, waiting for tap"); + Logging.Debug($"[FlippableCard] Now showing as NEW CARD at {newRarity}, waiting for tap"); } /// @@ -538,7 +539,7 @@ namespace UI.CardSystem // Check if we have the required number of elements (should match cardsToUpgrade) if (progressElements.Length < cardsToUpgrade) { - Debug.LogWarning($"[FlippableCard] Not enough Image components in progress bar! Expected {cardsToUpgrade}, found {progressElements.Length}"); + Logging.Warning($"[FlippableCard] Not enough Image components in progress bar! Expected {cardsToUpgrade}, found {progressElements.Length}"); onComplete?.Invoke(); return; } @@ -647,7 +648,7 @@ namespace UI.CardSystem { if (albumCard == null) { - Debug.LogWarning("[FlippableCard] Cannot extract AlbumCard - none found!"); + Logging.Warning("[FlippableCard] Cannot extract AlbumCard - none found!"); return null; } @@ -661,7 +662,7 @@ namespace UI.CardSystem albumCard.SetupCard(_cardData); } - Debug.Log($"[FlippableCard] Extracted AlbumCard '{_cardData?.Name}' to {newParent.name} - ready for tween"); + Logging.Debug($"[FlippableCard] Extracted AlbumCard '{_cardData?.Name}' to {newParent.name} - ready for tween"); return albumCard; } diff --git a/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs b/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs index 1ba5e86a..f7c11f5a 100644 --- a/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs +++ b/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using Core; using Data.CardSystem; using Pixelplacement; using UnityEngine; @@ -46,7 +47,7 @@ namespace UI.CardSystem // Singleton pattern if (Instance != null && Instance != this) { - Debug.LogWarning("[MinigameBoosterGiver] Duplicate instance found. Destroying."); + Logging.Warning("[MinigameBoosterGiver] Duplicate instance found. Destroying."); Destroy(gameObject); return; } @@ -99,7 +100,7 @@ namespace UI.CardSystem { if (_currentSequence != null) { - Debug.LogWarning("[MinigameBoosterGiver] Already running a sequence. Ignoring new request."); + Logging.Warning("[MinigameBoosterGiver] Already running a sequence. Ignoring new request."); return; } @@ -199,7 +200,7 @@ namespace UI.CardSystem } else { - Debug.LogWarning("[MinigameBoosterGiver] Scrapbook button not found in PlayerHudManager."); + Logging.Warning("[MinigameBoosterGiver] Scrapbook button not found in PlayerHudManager."); } // Calculate target position - use scrapbook button position if available @@ -232,7 +233,7 @@ namespace UI.CardSystem } else { - Debug.LogWarning("[MinigameBoosterGiver] Scrapbook button has no RectTransform, using fallback position."); + Logging.Warning("[MinigameBoosterGiver] Scrapbook button has no RectTransform, using fallback position."); targetPosition = GetFallbackPosition(); } } @@ -256,11 +257,11 @@ namespace UI.CardSystem if (CardSystemManager.Instance != null) { CardSystemManager.Instance.AddBoosterPack(1); - Debug.Log("[MinigameBoosterGiver] Booster pack granted!"); + Logging.Debug("[MinigameBoosterGiver] Booster pack granted!"); } else { - Debug.LogWarning("[MinigameBoosterGiver] CardSystemManager not found, cannot grant booster pack."); + Logging.Warning("[MinigameBoosterGiver] CardSystemManager not found, cannot grant booster pack."); } // Hide scrapbook button by disposing the context diff --git a/Assets/Scripts/UI/CardSystem/SlotContainerHelper.cs b/Assets/Scripts/UI/CardSystem/SlotContainerHelper.cs index 123253c3..4f0cd4b0 100644 --- a/Assets/Scripts/UI/CardSystem/SlotContainerHelper.cs +++ b/Assets/Scripts/UI/CardSystem/SlotContainerHelper.cs @@ -1,5 +1,6 @@  using System.Collections.Generic; -using UI.DragAndDrop.Core; + using Core; + using UI.DragAndDrop.Core; using UnityEngine; namespace UI.CardSystem @@ -22,7 +23,7 @@ namespace UI.CardSystem if (container == null || objects == null || objects.Count == 0) return; - Debug.Log($"[SlotContainerHelper] Shuffling {objects.Count} objects to front slots"); + Logging.Debug($"[SlotContainerHelper] Shuffling {objects.Count} objects to front slots"); // Unassign all objects from their current slots foreach (var obj in objects) @@ -41,12 +42,12 @@ namespace UI.CardSystem if (targetSlot != null) { - Debug.Log($"[SlotContainerHelper] Assigning object to slot with SlotIndex {i}"); + Logging.Debug($"[SlotContainerHelper] Assigning object to slot with SlotIndex {i}"); obj.AssignToSlot(targetSlot, animate); } else { - Debug.LogWarning($"[SlotContainerHelper] Could not find slot with SlotIndex {i}"); + Logging.Warning($"[SlotContainerHelper] Could not find slot with SlotIndex {i}"); } } } diff --git a/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs b/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs index d4cb7fea..8a66dab8 100644 --- a/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs +++ b/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using Core; using Pixelplacement; using UnityEngine; using UnityEngine.EventSystems; @@ -79,10 +80,10 @@ namespace UI.DragAndDrop.Core protected virtual void Initialize() { - Debug.Log($"[DraggableObject] Initializing {name} at world pos {transform.position}, local pos {transform.localPosition}, parent: {(transform.parent != null ? transform.parent.name : "NULL")}"); + Logging.Debug($"[DraggableObject] Initializing {name} at world pos {transform.position}, local pos {transform.localPosition}, parent: {(transform.parent != null ? transform.parent.name : "NULL")}"); _canvas = GetComponentInParent(); - Debug.Log($"[DraggableObject] {name} found canvas: {(_canvas != null ? _canvas.name : "NULL")}, canvas pos: {(_canvas != null ? _canvas.transform.position.ToString() : "N/A")}"); + Logging.Debug($"[DraggableObject] {name} found canvas: {(_canvas != null ? _canvas.name : "NULL")}, canvas pos: {(_canvas != null ? _canvas.transform.position.ToString() : "N/A")}"); _imageComponent = GetComponent(); _canvasGroup = GetComponent(); @@ -95,7 +96,7 @@ namespace UI.DragAndDrop.Core _imageComponent = gameObject.AddComponent(); _imageComponent.color = new Color(1, 1, 1, 0.01f); // Nearly transparent (0 doesn't work) _imageComponent.raycastTarget = true; - Debug.Log($"[DraggableObject] Added invisible Image to {name} for raycast detection"); + Logging.Debug($"[DraggableObject] Added invisible Image to {name} for raycast detection"); } // Use assigned visual, or find in children recursively if not assigned @@ -190,19 +191,19 @@ namespace UI.DragAndDrop.Core if (eventData.button != PointerEventData.InputButton.Left) return; - Debug.Log($"[DraggableObject] OnBeginDrag called on {name}. _isDraggingEnabled={_isDraggingEnabled}"); + Logging.Debug($"[DraggableObject] OnBeginDrag called on {name}. _isDraggingEnabled={_isDraggingEnabled}"); // Check if dragging is enabled BEFORE setting any state if (!_isDraggingEnabled) { - Debug.Log($"[DraggableObject] OnBeginDrag blocked - dragging disabled on {name}"); + Logging.Debug($"[DraggableObject] OnBeginDrag blocked - dragging disabled on {name}"); return; } _isDragging = true; _wasDragged = true; - Debug.Log($"[DraggableObject] Drag started on {name}"); + Logging.Debug($"[DraggableObject] Drag started on {name}"); // ...existing code... if (_canvas != null && _canvas.renderMode == RenderMode.ScreenSpaceOverlay && RectTransform != null) @@ -413,7 +414,7 @@ namespace UI.DragAndDrop.Core if (slot == null) return; - Debug.Log($"[DraggableObject] Assigning {name} to slot {slot.name}, animate={animate}, current pos={transform.position}, slot pos={slot.transform.position}"); + Logging.Debug($"[DraggableObject] Assigning {name} to slot {slot.name}, animate={animate}, current pos={transform.position}, slot pos={slot.transform.position}"); DraggableSlot previousSlot = _currentSlot; _currentSlot = slot; @@ -429,7 +430,7 @@ namespace UI.DragAndDrop.Core transform.SetParent(slot.transform); transform.localPosition = _isSelected ? new Vector3(0, selectionOffset, 0) : Vector3.zero; transform.localRotation = Quaternion.identity; - Debug.Log($"[DraggableObject] {name} assigned to slot {slot.name}, new world pos={transform.position}, local pos={transform.localPosition}"); + Logging.Debug($"[DraggableObject] {name} assigned to slot {slot.name}, new world pos={transform.position}, local pos={transform.localPosition}"); } OnSlotChanged?.Invoke(this, slot); @@ -510,14 +511,14 @@ namespace UI.DragAndDrop.Core /// public virtual void SetDraggingEnabled(bool enabled) { - Debug.Log($"[DraggableObject] SetDraggingEnabled({enabled}) called on {name}. _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}"); + Logging.Debug($"[DraggableObject] SetDraggingEnabled({enabled}) called on {name}. _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}"); _isDraggingEnabled = enabled; // If disabling dragging while actively dragging, stop the drag if (!enabled && _isDragging) { - Debug.Log($"[DraggableObject] Stopping active drag on {name}"); + Logging.Debug($"[DraggableObject] Stopping active drag on {name}"); _isDragging = false; // Re-enable raycasting @@ -529,7 +530,7 @@ namespace UI.DragAndDrop.Core _canvasGroup.blocksRaycasts = true; } - Debug.Log($"[DraggableObject] After SetDraggingEnabled: _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}"); + Logging.Debug($"[DraggableObject] After SetDraggingEnabled: _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}"); } #endregion diff --git a/Assets/Scripts/UI/DragAndDrop/Core/DraggableVisual.cs b/Assets/Scripts/UI/DragAndDrop/Core/DraggableVisual.cs index 1be3ba56..2abb2539 100644 --- a/Assets/Scripts/UI/DragAndDrop/Core/DraggableVisual.cs +++ b/Assets/Scripts/UI/DragAndDrop/Core/DraggableVisual.cs @@ -1,4 +1,5 @@ -using Pixelplacement; +using Core; +using Pixelplacement; using Pixelplacement.TweenSystem; using UnityEngine; using UnityEngine.InputSystem; // Added for new Input System @@ -67,14 +68,14 @@ namespace UI.DragAndDrop.Core _parentDraggable = parent; Canvas parentCanvas = parent.GetComponentInParent(); - Debug.Log($"[DraggableVisual] Initializing visual for {parent.name} at world pos {parent.transform.position}, parent canvas: {(parentCanvas != null ? parentCanvas.name + " (renderMode: " + parentCanvas.renderMode + ")" : "NULL")}"); + Logging.Debug($"[DraggableVisual] Initializing visual for {parent.name} at world pos {parent.transform.position}, parent canvas: {(parentCanvas != null ? parentCanvas.name + " (renderMode: " + parentCanvas.renderMode + ")" : "NULL")}"); // CRITICAL: Reparent visual to canvas (not base) so it can move independently // This enables the delayed follow effect if (parentCanvas != null) { transform.SetParent(parentCanvas.transform, true); // worldPositionStays = true - Debug.Log($"[DraggableVisual] Reparented visual {name} to canvas {parentCanvas.name} for independent movement"); + Logging.Debug($"[DraggableVisual] Reparented visual {name} to canvas {parentCanvas.name} for independent movement"); } // Get components if assigned (don't auto-create Canvas to avoid Unity's auto-reparenting) @@ -106,7 +107,7 @@ namespace UI.DragAndDrop.Core tiltParent.localRotation = Quaternion.identity; } - Debug.Log($"[DraggableVisual] Visual {name} initialized at world pos {transform.position}, local pos {transform.localPosition}, local rotation {transform.localRotation.eulerAngles}, parent at world pos {parent.transform.position}, local pos {parent.transform.localPosition}, rotation {parent.transform.rotation.eulerAngles}"); + Logging.Debug($"[DraggableVisual] Visual {name} initialized at world pos {transform.position}, local pos {transform.localPosition}, local rotation {transform.localRotation.eulerAngles}, parent at world pos {parent.transform.position}, local pos {parent.transform.localPosition}, rotation {parent.transform.rotation.eulerAngles}"); _isInitialized = true; @@ -202,7 +203,7 @@ namespace UI.DragAndDrop.Core float distance = Vector3.Distance(currentPosition, targetPosition); if (distance > 500f) { - Debug.LogWarning($"[DraggableVisual] Large position delta detected! Visual {name} at {currentPosition}, target {targetPosition}, parent {_parentDraggable.name}, distance: {distance}"); + Logging.Warning($"[DraggableVisual] Large position delta detected! Visual {name} at {currentPosition}, target {targetPosition}, parent {_parentDraggable.name}, distance: {distance}"); } // Apply follow logic with snappy easing diff --git a/Assets/Scripts/UI/HudMenuButton.cs b/Assets/Scripts/UI/HudMenuButton.cs index 808cb91d..b2ce8e8e 100644 --- a/Assets/Scripts/UI/HudMenuButton.cs +++ b/Assets/Scripts/UI/HudMenuButton.cs @@ -1,4 +1,5 @@ -using UI.Core; +using Core; +using UI.Core; using UnityEngine; using UnityEngine.UI; @@ -53,7 +54,7 @@ namespace UI return; } - Debug.Log($"[HudMenuButton] {buttonName} opening page from prefab: {pagePrefab.name}"); + Logging.Debug($"[HudMenuButton] {buttonName} opening page from prefab: {pagePrefab.name}"); UIPageController.Instance.PushPageFromPrefab(pagePrefab); } diff --git a/Assets/Scripts/UI/ScrapbookController.cs b/Assets/Scripts/UI/ScrapbookController.cs index 1dc19e29..4d98cb48 100644 --- a/Assets/Scripts/UI/ScrapbookController.cs +++ b/Assets/Scripts/UI/ScrapbookController.cs @@ -15,6 +15,6 @@ public class ScrapbookController : MonoBehaviour public void DebugClick() { - // Debug.Log("Yey I was clicked!"); + // Logging.Debug("Yey I was clicked!"); } } diff --git a/Assets/Scripts/UI/Tutorial/DivingTutorial.cs b/Assets/Scripts/UI/Tutorial/DivingTutorial.cs index 31ae59aa..4a3267e6 100644 --- a/Assets/Scripts/UI/Tutorial/DivingTutorial.cs +++ b/Assets/Scripts/UI/Tutorial/DivingTutorial.cs @@ -59,7 +59,7 @@ namespace UI.Tutorial void RemoveTutorial() { - Debug.Log("Remove me!"); + Logging.Debug("Remove me!"); if (_waitLoopCoroutine != null) { StopCoroutine(_waitLoopCoroutine); diff --git a/Assets/Scripts/Utils/AppleHillsUtils.cs b/Assets/Scripts/Utils/AppleHillsUtils.cs index 306bed2d..7977c207 100644 --- a/Assets/Scripts/Utils/AppleHillsUtils.cs +++ b/Assets/Scripts/Utils/AppleHillsUtils.cs @@ -101,7 +101,7 @@ namespace Utils } catch (System.Exception ex) { - Debug.LogWarning($"[AppleHillsUtils] Error checking addressable key existence: {ex.Message}"); + Logging.Warning($"[AppleHillsUtils] Error checking addressable key existence: {ex.Message}"); return false; } }