From e8180b21bf5bf1c3612f6acd6d24791bce0b9240 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Tue, 14 Oct 2025 15:53:58 +0200 Subject: [PATCH] Strip debug logging from the game, fix screen weirdness --- .../AddressableAssetSettings.asset | 2 +- Assets/Prefabs/UI/PauseMenu.prefab | 340 +++++++++++++++++- .../AppleHillsCamera/CameraScreenAdapter.cs | 9 +- Assets/Scripts/AppleHillsCamera/EdgeAnchor.cs | 15 +- .../Scripts/Cinematics/CinematicsManager.cs | 19 +- Assets/Scripts/Cinematics/SkipCinematic.cs | 7 +- Assets/Scripts/Core/GameManager.cs | 31 +- Assets/Scripts/Core/Logging.cs | 6 - Assets/Scripts/Core/SceneManagerService.cs | 11 +- .../Scripts/Core/SceneOrientationEnforcer.cs | 38 +- .../Developer/DeveloperSettingsProvider.cs | 5 +- .../Scripts/Core/Settings/ServiceLocator.cs | 7 +- .../AnneLiseBehaviour.cs | 3 +- .../AnnaLiseAnd Lurespots/DistanceMeasurer.cs | 2 +- .../LawnMowerPuzzle/GardenerBehaviour.cs | 3 +- .../LawnMowerPuzzle/LawnMowerBehaviour.cs | 5 +- .../Picnic/PicnicBehaviour.cs | 3 +- .../SoundBirdPuzzleSection/Sound Generator.cs | 5 +- .../soundBird_LandingBehaviour1.cs | 2 +- .../soundBird_TakeOffBehaviour.cs | 2 +- .../Data/CardSystem/CardSystemManager.cs | 13 +- .../Data/CardSystem/CardVisualConfig.cs | 7 +- Assets/Scripts/Dialogue/DialogueComponent.cs | 8 +- Assets/Scripts/Examples/QuickAccessExample.cs | 31 +- Assets/Scripts/Input/InputManager.cs | 41 +-- Assets/Scripts/Input/PlayerTouchController.cs | 11 +- Assets/Scripts/Interactions/Interactable.cs | 11 +- .../Interactions/InteractionTimelineAction.cs | 15 +- Assets/Scripts/Interactions/ItemSlot.cs | 2 +- Assets/Scripts/Interactions/Pickup.cs | 2 +- Assets/Scripts/LevelS/LevelSwitch.cs | 2 +- .../DivingForPictures/Bubbles/Bubble.cs | 7 +- .../DivingForPictures/Bubbles/BubblePool.cs | 5 +- .../Bubbles/BubbleSpawner.cs | 13 +- .../DivingForPictures/DivingGameManager.cs | 75 ++-- .../DivingForPictures/Monster/Monster.cs | 5 +- .../Obstacles/FloatingObstacle.cs | 31 +- .../Obstacles/ObstaclePool.cs | 11 +- .../Obstacles/ObstacleSpawner.cs | 73 ++-- .../PictureCamera/CameraViewfinderManager.cs | 27 +- .../PictureCamera/Viewfinder.cs | 9 +- .../Player/ObstacleCollision.cs | 11 +- .../Player/PlayerBlinkBehavior.cs | 3 +- .../Player/PlayerCollisionBehavior.cs | 5 +- .../Player/PlayerController.cs | 15 +- .../Player/RopeEndPhysicsFollower.cs | 27 +- .../Player/TileBumpCollision.cs | 11 +- .../DivingForPictures/Tiles/TrenchTilePool.cs | 3 +- .../Tiles/TrenchTileSpawner.cs | 35 +- Assets/Scripts/Pooling/BaseObjectPool.cs | 5 +- Assets/Scripts/Pooling/MultiPrefabPool.cs | 29 +- .../Scripts/PuzzleS/ObjectiveStepBehaviour.cs | 21 +- Assets/Scripts/PuzzleS/PuzzleManager.cs | 27 +- Assets/Scripts/UI/CardSystem/AlbumViewPage.cs | 3 +- .../UI/CardSystem/BoosterOpeningPage.cs | 3 +- Assets/Scripts/UI/CardSystem/CardAlbumUI.cs | 3 +- Assets/Scripts/UI/CardSystem/CardMenuPage.cs | 3 +- Assets/Scripts/UI/CardSystem/CardUIElement.cs | 11 +- .../Scripts/UI/CardSystem/UIPageController.cs | 9 +- Assets/Scripts/UI/LoadingScreenController.cs | 14 +- Assets/Scripts/UI/MainMenu.cs | 2 +- Assets/Scripts/UI/PauseMenu.cs | 16 +- Assets/Scripts/Utils/AppleHillsUtils.cs | 3 +- ProjectSettings/EditorBuildSettings.asset | 3 - ProjectSettings/ProjectSettings.asset | 3 +- 65 files changed, 768 insertions(+), 411 deletions(-) diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Assets/AddressableAssetsData/AddressableAssetSettings.asset index 8e4c5ea7..480e504a 100644 --- a/Assets/AddressableAssetsData/AddressableAssetSettings.asset +++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset @@ -15,7 +15,7 @@ MonoBehaviour: m_DefaultGroup: 6f3207429a65b3e4b83935ac19791077 m_currentHash: serializedVersion: 2 - Hash: 8453796ea514a8db40e72d511ee4981c + Hash: 00000000000000000000000000000000 m_OptimizeCatalogSize: 0 m_BuildRemoteCatalog: 0 m_CatalogRequestsTimeout: 0 diff --git a/Assets/Prefabs/UI/PauseMenu.prefab b/Assets/Prefabs/UI/PauseMenu.prefab index 159ae74a..51cc9283 100644 --- a/Assets/Prefabs/UI/PauseMenu.prefab +++ b/Assets/Prefabs/UI/PauseMenu.prefab @@ -92,7 +92,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1302888740346723223 RectTransform: m_ObjectHideFlags: 0 @@ -688,8 +688,8 @@ RectTransform: - {fileID: 3400029894692319192} m_Father: {fileID: 5605205583985027889} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} @@ -823,9 +823,9 @@ RectTransform: - {fileID: 7803147924421545447} m_Father: {fileID: 5605205583985027889} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -60} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2290562928139384544 @@ -1642,9 +1642,9 @@ RectTransform: - {fileID: 6162719476639538323} m_Father: {fileID: 5605205583985027889} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 120} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3956398402257402681 @@ -1741,6 +1741,139 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 1 m_CallState: 2 +--- !u!1 &5428575275238917432 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7984867635544047636} + - component: {fileID: 7625231543093897207} + - component: {fileID: 2449943578766449663} + - component: {fileID: 2858549979657146258} + m_Layer: 0 + m_Name: Exit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7984867635544047636 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5428575275238917432} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3120496234660820654} + m_Father: {fileID: 5605205583985027889} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7625231543093897207 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5428575275238917432} + m_CullTransparentMesh: 1 +--- !u!114 &2449943578766449663 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5428575275238917432} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2858549979657146258 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5428575275238917432} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 0.85165936, b: 0.5058824, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2449943578766449663} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 7928661763020144797} + m_TargetAssemblyTypeName: UI.PauseMenu, AppleHillsScripts + m_MethodName: ReloadLevel + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &5544888797992325527 GameObject: m_ObjectHideFlags: 0 @@ -1775,9 +1908,9 @@ RectTransform: - {fileID: 3949582524682304579} m_Father: {fileID: 5605205583985027889} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 60} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4255447181943714037 @@ -2323,6 +2456,142 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &8078932926504279854 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3120496234660820654} + - component: {fileID: 6119350696632336213} + - component: {fileID: 3030293546037678981} + m_Layer: 0 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3120496234660820654 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8078932926504279854} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7984867635544047636} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6119350696632336213 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8078932926504279854} + m_CullTransparentMesh: 1 +--- !u!114 &3030293546037678981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8078932926504279854} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Reload current + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 20 + m_fontSizeBase: 20 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &8099213920311068351 GameObject: m_ObjectHideFlags: 0 @@ -2468,6 +2737,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5605205583985027889} + - component: {fileID: 8594443110142453154} + - component: {fileID: 3446002550086852002} m_Layer: 0 m_Name: Buttons m_TagString: Untagged @@ -2490,11 +2761,52 @@ RectTransform: - {fileID: 9052230212113207254} - {fileID: 44375243138864492} - {fileID: 6855320393561945426} + - {fileID: 7984867635544047636} - {fileID: 7083543314533737593} m_Father: {fileID: 1302888740346723223} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 0, y: 120} - m_SizeDelta: {x: 100, y: 100} + m_AnchoredPosition: {x: -6.442688, y: 141.47559} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &8594443110142453154 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9039430485754110792} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 17.13 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &3446002550086852002 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9039430485754110792} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter + m_HorizontalFit: 2 + m_VerticalFit: 2 diff --git a/Assets/Scripts/AppleHillsCamera/CameraScreenAdapter.cs b/Assets/Scripts/AppleHillsCamera/CameraScreenAdapter.cs index c986cfb1..8eb3e081 100644 --- a/Assets/Scripts/AppleHillsCamera/CameraScreenAdapter.cs +++ b/Assets/Scripts/AppleHillsCamera/CameraScreenAdapter.cs @@ -1,6 +1,7 @@ using UnityEngine; using Unity.Cinemachine; using System; +using Core; namespace AppleHillsCamera { @@ -76,7 +77,7 @@ namespace AppleHillsCamera { if (referenceMarker == null) { - Debug.LogWarning("CameraScreenAdapter: Missing reference marker."); + Logging.Warning("CameraScreenAdapter: Missing reference marker."); return; } @@ -95,7 +96,7 @@ namespace AppleHillsCamera var lens = _virtualCamera.Lens; lens.OrthographicSize = orthoSize; _virtualCamera.Lens = lens; - Debug.Log($"Cinemachine Camera adapted: Width={targetWidth}, Aspect={screenAspect:F2}, OrthoSize={orthoSize:F2}"); + Logging.Debug($"Cinemachine Camera adapted: Width={targetWidth}, Aspect={screenAspect:F2}, OrthoSize={orthoSize:F2}"); } else { @@ -103,11 +104,11 @@ namespace AppleHillsCamera if (_regularCamera.orthographic) { _regularCamera.orthographicSize = orthoSize; - Debug.Log($"Camera adapted: Width={targetWidth}, Aspect={screenAspect:F2}, OrthoSize={orthoSize:F2}"); + Logging.Debug($"Camera adapted: Width={targetWidth}, Aspect={screenAspect:F2}, OrthoSize={orthoSize:F2}"); } else { - Debug.LogWarning("CameraScreenAdapter: Regular camera is not in orthographic mode."); + Logging.Warning("CameraScreenAdapter: Regular camera is not in orthographic mode."); return; } } diff --git a/Assets/Scripts/AppleHillsCamera/EdgeAnchor.cs b/Assets/Scripts/AppleHillsCamera/EdgeAnchor.cs index 74f18dab..8b2846f7 100644 --- a/Assets/Scripts/AppleHillsCamera/EdgeAnchor.cs +++ b/Assets/Scripts/AppleHillsCamera/EdgeAnchor.cs @@ -1,6 +1,7 @@ using AppleHills.Core; using UnityEngine; using System; +using Core; namespace AppleHillsCamera { @@ -168,7 +169,7 @@ namespace AppleHillsCamera { if (debugMode) { - Debug.Log($"Camera adjusted event received by {gameObject.name}, updating position"); + Logging.Debug($"Camera adjusted event received by {gameObject.name}, updating position"); } // Ensure we have the latest camera reference @@ -210,14 +211,14 @@ namespace AppleHillsCamera if (_camera != null && adapter.GetControlledCamera() == _camera) { cameraAdapter = adapter; - Debug.Log($"EdgeAnchor on {gameObject.name} auto-connected to CameraScreenAdapter on {cameraAdapter.gameObject.name}"); + Logging.Debug($"EdgeAnchor on {gameObject.name} auto-connected to CameraScreenAdapter on {cameraAdapter.gameObject.name}"); return; } } // If no matching camera found, use the first one cameraAdapter = adapters[0]; - Debug.Log($"EdgeAnchor on {gameObject.name} auto-connected to CameraScreenAdapter on {cameraAdapter.gameObject.name}"); + Logging.Debug($"EdgeAnchor on {gameObject.name} auto-connected to CameraScreenAdapter on {cameraAdapter.gameObject.name}"); } } @@ -237,7 +238,7 @@ namespace AppleHillsCamera { if (debugMode) { - Debug.Log($"{gameObject.name}: Camera ortho size changed from {_lastOrthoSize} to {_camera.orthographicSize}"); + Logging.Debug($"{gameObject.name}: Camera ortho size changed from {_lastOrthoSize} to {_camera.orthographicSize}"); } _lastOrthoSize = _camera.orthographicSize; shouldUpdate = true; @@ -296,7 +297,7 @@ namespace AppleHillsCamera } else if (_camera != prevCamera && debugMode) { - Debug.Log($"{gameObject.name}: Camera reference updated to {_camera.name}"); + Logging.Debug($"{gameObject.name}: Camera reference updated to {_camera.name}"); } } @@ -340,7 +341,7 @@ namespace AppleHillsCamera { if (referenceMarker == null) { - Debug.LogWarning("EdgeAnchor: Missing reference marker."); + Logging.Warning("EdgeAnchor: Missing reference marker."); return; } @@ -377,7 +378,7 @@ namespace AppleHillsCamera // Apply the new position if (debugMode && Vector3.Distance(transform.position, newPosition) > 0.01f) { - Debug.Log($"{gameObject.name} position updated: {transform.position} -> {newPosition}, Camera OrthoSize: {_camera.orthographicSize}"); + Logging.Debug($"{gameObject.name} position updated: {transform.position} -> {newPosition}, Camera OrthoSize: {_camera.orthographicSize}"); } transform.position = newPosition; diff --git a/Assets/Scripts/Cinematics/CinematicsManager.cs b/Assets/Scripts/Cinematics/CinematicsManager.cs index 6ceb1e60..e8dbf1a5 100644 --- a/Assets/Scripts/Cinematics/CinematicsManager.cs +++ b/Assets/Scripts/Cinematics/CinematicsManager.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Core; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; @@ -72,7 +73,7 @@ namespace Cinematics _cinematicSprites.enabled = true; playableDirector.stopped += OnPlayableDirectorStopped; playableDirector.Play(assetToPlay); - Debug.Log("Playing cinematic " + assetToPlay.name); + Logging.Debug("Playing cinematic " + assetToPlay.name); _isCinematicPlaying = true; OnCinematicStarted?.Invoke(); return playableDirector; @@ -81,7 +82,7 @@ namespace Cinematics void OnPlayableDirectorStopped(PlayableDirector director) { _cinematicSprites.enabled = false; - Debug.Log("Cinematic stopped!"); + Logging.Debug("Cinematic stopped!"); _isCinematicPlaying = false; OnCinematicStopped?.Invoke(); // Release the addressable handle associated with this director @@ -100,7 +101,7 @@ namespace Cinematics // Store the handle for later release _addressableHandles[playableDirector] = handle; - Debug.Log($"[CinematicsManager] Loaded addressable cinematic: {key}"); + Logging.Debug($"[CinematicsManager] Loaded addressable cinematic: {key}"); return PlayCinematic(result); } @@ -112,7 +113,7 @@ namespace Cinematics { if (playableDirector != null && playableDirector.state == PlayState.Playing) { - Debug.Log("Skipping current cinematic"); + Logging.Debug("Skipping current cinematic"); playableDirector.Stop(); } } @@ -124,7 +125,7 @@ namespace Cinematics { if (_addressableHandles.TryGetValue(director, out var handle)) { - Debug.Log($"[CinematicsManager] Releasing addressable handle for cinematic"); + Logging.Debug($"[CinematicsManager] Releasing addressable handle for cinematic"); Addressables.Release(handle); _addressableHandles.Remove(director); } @@ -157,7 +158,7 @@ namespace Cinematics /// The PlayableDirector playing the cinematic public async System.Threading.Tasks.Task PlayCinematicWithLoadingScreen(string key) { - Debug.Log($"[CinematicsManager] Preparing to load cinematic with loading screen: {key}"); + Logging.Debug($"[CinematicsManager] Preparing to load cinematic with loading screen: {key}"); // First, show the loading screen BEFORE creating any async operations UI.LoadingScreenController.Instance.ShowLoadingScreen(); @@ -166,7 +167,7 @@ namespace Cinematics await System.Threading.Tasks.Task.Yield(); // Now create the load handle and track its progress - Debug.Log($"[CinematicsManager] Starting cinematic asset load: {key}"); + Logging.Debug($"[CinematicsManager] Starting cinematic asset load: {key}"); AsyncOperationHandle handle = Addressables.LoadAssetAsync(key); // Update the loading screen with the progress provider after the handle is created @@ -178,7 +179,7 @@ namespace Cinematics // Store the handle for later release _addressableHandles[playableDirector] = handle; - Debug.Log($"[CinematicsManager] Cinematic loaded: {key}"); + Logging.Debug($"[CinematicsManager] Cinematic loaded: {key}"); // Hide the loading screen UI.LoadingScreenController.Instance.HideLoadingScreen(); @@ -186,7 +187,7 @@ namespace Cinematics // Important: Wait for the loading screen to be fully hidden before playing the cinematic await UI.LoadingScreenController.Instance.WaitForLoadingScreenToHideAsync(); - Debug.Log($"[CinematicsManager] Loading screen hidden, now playing cinematic: {key}"); + Logging.Debug($"[CinematicsManager] Loading screen hidden, now playing cinematic: {key}"); // Play the cinematic return PlayCinematic(result); diff --git a/Assets/Scripts/Cinematics/SkipCinematic.cs b/Assets/Scripts/Cinematics/SkipCinematic.cs index fb7f6738..17e546a9 100644 --- a/Assets/Scripts/Cinematics/SkipCinematic.cs +++ b/Assets/Scripts/Cinematics/SkipCinematic.cs @@ -1,3 +1,4 @@ +using Core; using Input; using UnityEngine; using UnityEngine.UI; @@ -76,7 +77,7 @@ namespace Cinematics private void DoSkipCinematic() { CinematicsManager.Instance.SkipCurrentCinematic(); - Debug.Log("Cinematic skipped via touch hold"); + Logging.Debug("Cinematic skipped via touch hold"); // Reset UI if (radialProgressBar != null) @@ -101,7 +102,7 @@ namespace Cinematics _skipPerformed = false; _holdStartTime = Time.time; - Debug.Log("Starting cinematic skip gesture"); + Logging.Debug("Starting cinematic skip gesture"); } public void OnHoldMove(Vector2 position) @@ -120,7 +121,7 @@ namespace Cinematics radialProgressBar.fillAmount = 0f; } - Debug.Log("Cinematic skip gesture canceled"); + Logging.Debug("Cinematic skip gesture canceled"); } #endregion } diff --git a/Assets/Scripts/Core/GameManager.cs b/Assets/Scripts/Core/GameManager.cs index 0dde7ffc..db282188 100644 --- a/Assets/Scripts/Core/GameManager.cs +++ b/Assets/Scripts/Core/GameManager.cs @@ -3,6 +3,7 @@ using AppleHills.Core.Settings; using System; using System.Collections.Generic; using AppleHills.Core.Interfaces; +using Core; using UI; /// @@ -81,11 +82,11 @@ public class GameManager : MonoBehaviour pauseMenu.OnGamePaused += OnPauseMenuPaused; pauseMenu.OnGameResumed += OnPauseMenuResumed; - Debug.Log("[GameManager] Subscribed to PauseMenu events"); + Logging.Debug("[GameManager] Subscribed to PauseMenu events"); } else { - Debug.LogWarning("[GameManager] PauseMenu not found. Pause functionality won't work properly."); + Logging.Warning("[GameManager] PauseMenu not found. Pause functionality won't work properly."); } } @@ -116,7 +117,7 @@ public class GameManager : MonoBehaviour component.Pause(); } - Debug.Log($"[GameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); + Logging.Debug($"[GameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); } } @@ -129,7 +130,7 @@ public class GameManager : MonoBehaviour if (component != null && _pausableComponents.Contains(component)) { _pausableComponents.Remove(component); - Debug.Log($"[GameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); + Logging.Debug($"[GameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); } } @@ -167,7 +168,7 @@ public class GameManager : MonoBehaviour // Broadcast pause event OnGamePaused?.Invoke(); - Debug.Log($"[GameManager] Game paused. Paused {_pausableComponents.Count} components."); + Logging.Debug($"[GameManager] Game paused. Paused {_pausableComponents.Count} components."); } /// @@ -188,7 +189,7 @@ public class GameManager : MonoBehaviour // Broadcast resume event OnGameResumed?.Invoke(); - Debug.Log($"[GameManager] Game resumed. Resumed {_pausableComponents.Count} components."); + Logging.Debug($"[GameManager] Game resumed. Resumed {_pausableComponents.Count} components."); } /// @@ -204,7 +205,7 @@ public class GameManager : MonoBehaviour private void InitializeSettings() { - Debug.Log("Starting settings initialization..."); + Logging.Debug("Starting settings initialization..."); // Load settings synchronously var playerSettings = SettingsProvider.Instance.LoadSettingsSynchronous(); @@ -215,7 +216,7 @@ public class GameManager : MonoBehaviour if (playerSettings != null) { ServiceLocator.Register(playerSettings); - Debug.Log("PlayerFollowerSettings registered successfully"); + Logging.Debug("PlayerFollowerSettings registered successfully"); } else { @@ -225,7 +226,7 @@ public class GameManager : MonoBehaviour if (interactionSettings != null) { ServiceLocator.Register(interactionSettings); - Debug.Log("InteractionSettings registered successfully"); + Logging.Debug("InteractionSettings registered successfully"); } else { @@ -235,7 +236,7 @@ public class GameManager : MonoBehaviour if (minigameSettings != null) { ServiceLocator.Register(minigameSettings); - Debug.Log("MinigameSettings registered successfully"); + Logging.Debug("MinigameSettings registered successfully"); } else { @@ -246,11 +247,11 @@ public class GameManager : MonoBehaviour _settingsLoaded = playerSettings != null && interactionSettings != null && minigameSettings != null; if (_settingsLoaded) { - Debug.Log("All settings loaded and registered with ServiceLocator"); + Logging.Debug("All settings loaded and registered with ServiceLocator"); } else { - Debug.LogWarning("Some settings failed to load - check that all settings assets exist and are marked as Addressables"); + Logging.Warning("Some settings failed to load - check that all settings assets exist and are marked as Addressables"); } } @@ -259,7 +260,7 @@ public class GameManager : MonoBehaviour /// private void InitializeDeveloperSettings() { - Debug.Log("Starting developer settings initialization..."); + Logging.Debug("Starting developer settings initialization..."); // Load developer settings var divingDevSettings = DeveloperSettingsProvider.Instance.GetSettings(); @@ -268,11 +269,11 @@ public class GameManager : MonoBehaviour if (_developerSettingsLoaded) { - Debug.Log("All developer settings loaded successfully"); + Logging.Debug("All developer settings loaded successfully"); } else { - Debug.LogWarning("Some developer settings failed to load"); + Logging.Warning("Some developer settings failed to load"); } } diff --git a/Assets/Scripts/Core/Logging.cs b/Assets/Scripts/Core/Logging.cs index 9f636cd6..a0c0d387 100644 --- a/Assets/Scripts/Core/Logging.cs +++ b/Assets/Scripts/Core/Logging.cs @@ -13,11 +13,5 @@ { UnityEngine.Debug.LogWarning(message); } - - [System.Diagnostics.Conditional("ENABLE_LOG")] - public static void Error(object message) - { - UnityEngine.Debug.LogError(message); - } } } \ No newline at end of file diff --git a/Assets/Scripts/Core/SceneManagerService.cs b/Assets/Scripts/Core/SceneManagerService.cs index 9d3a763b..3ecc6a8f 100644 --- a/Assets/Scripts/Core/SceneManagerService.cs +++ b/Assets/Scripts/Core/SceneManagerService.cs @@ -123,7 +123,7 @@ namespace Core var scene = SceneManager.GetSceneByName(sceneName); if (!scene.isLoaded) { - Debug.LogWarning($"SceneManagerService: Attempted to unload scene '{sceneName}', but it is not loaded."); + Logging.Warning($"SceneManagerService: Attempted to unload scene '{sceneName}', but it is not loaded."); return; } SceneUnloadStarted?.Invoke(sceneName); @@ -264,6 +264,11 @@ namespace Core // Tracks the currently loaded gameplay scene (not persistent/bootstrapper) public string CurrentGameplayScene { get; private set; } = "MainMenu"; + public async Task ReloadCurrentScene(IProgress progress = null) + { + await SwitchSceneAsync(CurrentGameplayScene, progress); + } + // Switches from current gameplay scene to a new one public async Task SwitchSceneAsync(string newSceneName, IProgress progress = null) { @@ -277,7 +282,7 @@ namespace Core DestroyImmediate(astar.gameObject); } // Unload previous gameplay scene (if not BootstrapScene and not same as new) - if (!string.IsNullOrEmpty(CurrentGameplayScene) && CurrentGameplayScene != newSceneName && CurrentGameplayScene != BootstrapSceneName) + if (!string.IsNullOrEmpty(CurrentGameplayScene)&& CurrentGameplayScene != BootstrapSceneName) { var prevScene = SceneManager.GetSceneByName(CurrentGameplayScene); if (prevScene.isLoaded) @@ -286,7 +291,7 @@ namespace Core } else { - Debug.LogWarning($"SceneManagerService: Previous scene '{CurrentGameplayScene}' is not loaded, skipping unload."); + Logging.Warning($"SceneManagerService: Previous scene '{CurrentGameplayScene}' is not loaded, skipping unload."); } } // Ensure BootstrapScene is loaded before loading new scene diff --git a/Assets/Scripts/Core/SceneOrientationEnforcer.cs b/Assets/Scripts/Core/SceneOrientationEnforcer.cs index 4380ca94..ca5c8b0c 100644 --- a/Assets/Scripts/Core/SceneOrientationEnforcer.cs +++ b/Assets/Scripts/Core/SceneOrientationEnforcer.cs @@ -35,6 +35,7 @@ namespace Utility public GameObject orientationPromptPrefab; public event Action OnOrientationCorrect; + public event Action OnOrientationIncorrect; private GameObject _promptInstance; private ScreenOrientationRequirement _requiredOrientation; @@ -139,6 +140,13 @@ namespace Utility private System.Collections.IEnumerator ContinuousOrientationCheckRoutine() { + while (!IsOrientationCorrect()) + { + yield return new WaitForSeconds(0.5f); + } + _orientationCorrect = true; + OnOrientationCorrect?.Invoke(); + while (true) { // Wait for a short interval before checking again @@ -147,33 +155,11 @@ namespace Utility // Check if orientation is now incorrect if (!IsOrientationCorrect()) { - // Pause the game using DivingGameManager - if (DivingGameManager.Instance != null) - { - DivingGameManager.Instance.Pause(); - } - - // Show the orientation prompt + OnOrientationIncorrect?.Invoke();; + InputManager.Instance.SetInputMode(InputMode.UI); ShowPrompt(); - - // Wait until orientation is correct again - while (!IsOrientationCorrect()) - { - yield return new WaitForSeconds(0.2f); - } - - // Hide the prompt when orientation is correct again - if (_promptInstance != null) - { - Destroy(_promptInstance); - _promptInstance = null; - } - - // Resume the game using DivingGameManager - if (DivingGameManager.Instance != null) - { - DivingGameManager.Instance.DoResume(); - } + _continuousOrientationCheckCoroutine = StartCoroutine(ContinuousOrientationCheckRoutine()); + yield break; // Exit this coroutine } } } diff --git a/Assets/Scripts/Core/Settings/Developer/DeveloperSettingsProvider.cs b/Assets/Scripts/Core/Settings/Developer/DeveloperSettingsProvider.cs index d4608552..7b491909 100644 --- a/Assets/Scripts/Core/Settings/Developer/DeveloperSettingsProvider.cs +++ b/Assets/Scripts/Core/Settings/Developer/DeveloperSettingsProvider.cs @@ -2,6 +2,7 @@ using UnityEngine; using UnityEngine.AddressableAssets; using System; +using Core; namespace AppleHills.Core.Settings { @@ -91,13 +92,13 @@ namespace AppleHills.Core.Settings Debug.LogError($"Failed to load developer settings at '{key}': {e.Message}"); } - Debug.LogWarning($"Developer settings of type {type.Name} not found at addressable path '{key}'"); + Logging.Warning($"Developer settings of type {type.Name} not found at addressable path '{key}'"); // Fallback to Resources for backward compatibility T resourcesSettings = Resources.Load($"{_addressablePath}/{type.Name}"); if (resourcesSettings != null) { - Debug.Log($"Found developer settings in Resources instead of Addressables at '{_addressablePath}/{type.Name}'"); + Logging.Debug($"Found developer settings in Resources instead of Addressables at '{_addressablePath}/{type.Name}'"); _settingsCache[type] = resourcesSettings; return resourcesSettings; } diff --git a/Assets/Scripts/Core/Settings/ServiceLocator.cs b/Assets/Scripts/Core/Settings/ServiceLocator.cs index 4b1b4e75..222dd2f0 100644 --- a/Assets/Scripts/Core/Settings/ServiceLocator.cs +++ b/Assets/Scripts/Core/Settings/ServiceLocator.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Core; using UnityEngine; namespace AppleHills.Core.Settings @@ -20,7 +21,7 @@ namespace AppleHills.Core.Settings public static void Register(T service) where T : class { _services[typeof(T)] = service; - Debug.Log($"Service registered: {typeof(T).Name}"); + Logging.Debug($"Service registered: {typeof(T).Name}"); } /// @@ -35,7 +36,7 @@ namespace AppleHills.Core.Settings return service as T; } - Debug.LogWarning($"Service of type {typeof(T).Name} not found!"); + Logging.Warning($"Service of type {typeof(T).Name} not found!"); return null; } @@ -45,7 +46,7 @@ namespace AppleHills.Core.Settings public static void Clear() { _services.Clear(); - Debug.Log("All services cleared"); + Logging.Debug("All services cleared"); } } } diff --git a/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/AnneLiseBehaviour.cs b/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/AnneLiseBehaviour.cs index 6aefb784..37bdc90c 100644 --- a/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/AnneLiseBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/AnneLiseBehaviour.cs @@ -1,6 +1,7 @@ using UnityEngine; using System; using System.Collections; +using Core; using Pathfinding; public class AnneLiseBehaviour : MonoBehaviour @@ -162,6 +163,6 @@ public class AnneLiseBehaviour : MonoBehaviour } annaLiseIsReady = false; // Reset the flag after taking the photo } - Debug.Log("Trafalgar touched Anna Lise"); + Logging.Debug("Trafalgar touched Anna Lise"); } } diff --git a/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/DistanceMeasurer.cs b/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/DistanceMeasurer.cs index 91b31d2f..98be4df5 100644 --- a/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/DistanceMeasurer.cs +++ b/Assets/Scripts/DamianExperiments/AnnaLiseAnd Lurespots/DistanceMeasurer.cs @@ -24,7 +24,7 @@ public class Distancemeasurer : MonoBehaviour { playerPosition = player.transform.position; distance = Vector2.Distance(placePosition, playerPosition); - //Debug.Log("Distance to player: " + distance); + //Logging.Debug("Distance to player: " + distance); if (distance > playerToPlaceDistance && birdEyes.correctItemIsIn == true) { birdEyes.BirdReveal(); diff --git a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs index 6e85d960..686eba56 100644 --- a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs @@ -1,4 +1,5 @@ using System.Security.Cryptography.X509Certificates; +using Core; using Pixelplacement; using UnityEngine; @@ -20,7 +21,7 @@ public class GardenerBehaviour : MonoBehaviour public void stateSwitch (string StateName) { - Debug.Log("State Switch to: " + StateName); + Logging.Debug("State Switch to: " + StateName); stateMachineRef.ChangeState(StateName); } } diff --git a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs index c2d02dfe..9d72223c 100644 --- a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs @@ -1,3 +1,4 @@ +using Core; using UnityEngine; using Pixelplacement; @@ -18,12 +19,12 @@ public class LawnMowerBehaviour : MonoBehaviour } public void mowerTouched() { - Debug.Log("Mower Touched"); + Logging.Debug("Mower Touched"); } public void stateSwitch(string StateName) { - Debug.Log("State Switch to: " + StateName); + Logging.Debug("State Switch to: " + StateName); stateMachineRef.ChangeState(StateName); } } diff --git a/Assets/Scripts/DamianExperiments/Picnic/PicnicBehaviour.cs b/Assets/Scripts/DamianExperiments/Picnic/PicnicBehaviour.cs index e08f6583..9173a8da 100644 --- a/Assets/Scripts/DamianExperiments/Picnic/PicnicBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/Picnic/PicnicBehaviour.cs @@ -1,6 +1,7 @@ using UnityEngine; using Pixelplacement; using System.Collections; +using Core; public class PicnicBehaviour : MonoBehaviour { @@ -56,7 +57,7 @@ public class PicnicBehaviour : MonoBehaviour { animator.SetTrigger("theyAngry"); //stateMachine.ChangeState("Picnic PPL Angry"); - Debug.Log("Hey! Don't steal my chocolate!"); + Logging.Debug("Hey! Don't steal my chocolate!"); } public void destroyFakeChocolate() diff --git a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/Sound Generator.cs b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/Sound Generator.cs index c307121d..235b5b86 100644 --- a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/Sound Generator.cs +++ b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/Sound Generator.cs @@ -1,3 +1,4 @@ +using Core; using Pixelplacement; using UnityEngine; @@ -27,7 +28,7 @@ public class SoundGenerator : MonoBehaviour if (!playerInside && other.CompareTag("Player")) { playerInside = true; - Debug.Log("Player entered SoundGenerator trigger!"); + Logging.Debug("Player entered SoundGenerator trigger!"); if (spriteRenderer != null && enterSprite != null) { spriteRenderer.sprite = enterSprite; @@ -49,7 +50,7 @@ public class SoundGenerator : MonoBehaviour if (playerInside && other.CompareTag("Player")) { playerInside = false; - Debug.Log("Player exited SoundGenerator trigger!"); + Logging.Debug("Player exited SoundGenerator trigger!"); if (spriteRenderer != null && exitSprite != null) { spriteRenderer.sprite = exitSprite; diff --git a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_LandingBehaviour1.cs b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_LandingBehaviour1.cs index ca6f7ffb..71a27452 100644 --- a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_LandingBehaviour1.cs +++ b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_LandingBehaviour1.cs @@ -48,7 +48,7 @@ public class soundBird_LandingBehaviour1 : MonoBehaviour { objectTween.Cancel(); // Stop the spline tween for this object } - //Debug.Log("Tween finished!"); + //Logging.Debug("Tween finished!"); if (stateMachine != null) { animator.SetBool("isScared", false); diff --git a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_TakeOffBehaviour.cs b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_TakeOffBehaviour.cs index faeae18f..d5c8c123 100644 --- a/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_TakeOffBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/SoundBirdPuzzleSection/soundBird_TakeOffBehaviour.cs @@ -38,7 +38,7 @@ public class soundBird_TakeOffBehaviour : MonoBehaviour objectTween.Cancel(); // Stop the spline tween for this object } - //Debug.Log("Tween finished!"); + //Logging.Debug("Tween finished!"); if (stateMachine != null) { stateMachine.ChangeState("SoundBirdFlyAround"); // Change to the desired state name diff --git a/Assets/Scripts/Data/CardSystem/CardSystemManager.cs b/Assets/Scripts/Data/CardSystem/CardSystemManager.cs index 183b4e0d..f2027b21 100644 --- a/Assets/Scripts/Data/CardSystem/CardSystemManager.cs +++ b/Assets/Scripts/Data/CardSystem/CardSystemManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using AppleHills.Data.CardSystem; +using Core; using UnityEngine; namespace Data.CardSystem @@ -100,7 +101,7 @@ namespace Data.CardSystem { playerInventory.BoosterPackCount += count; OnBoosterCountChanged?.Invoke(playerInventory.BoosterPackCount); - Debug.Log($"[CardSystemManager] Added {count} booster pack(s). Total: {playerInventory.BoosterPackCount}"); + Logging.Debug($"[CardSystemManager] Added {count} booster pack(s). Total: {playerInventory.BoosterPackCount}"); } /// @@ -110,7 +111,7 @@ namespace Data.CardSystem { if (playerInventory.BoosterPackCount <= 0) { - Debug.LogWarning("[CardSystemManager] Attempted to open a booster pack, but none are available."); + Logging.Warning("[CardSystemManager] Attempted to open a booster pack, but none are available."); return new List(); } @@ -129,7 +130,7 @@ namespace Data.CardSystem // Notify listeners OnBoosterOpened?.Invoke(drawnCards); - Debug.Log($"[CardSystemManager] Opened a booster pack and obtained {drawnCards.Count} cards. Remaining boosters: {playerInventory.BoosterPackCount}"); + Logging.Debug($"[CardSystemManager] Opened a booster pack and obtained {drawnCards.Count} cards. Remaining boosters: {playerInventory.BoosterPackCount}"); return drawnCards; } @@ -150,7 +151,7 @@ namespace Data.CardSystem OnCardRarityUpgraded?.Invoke(existingCard); } - Debug.Log($"[CardSystemManager] Added duplicate card '{card.Name}'. Now have {existingCard.CopiesOwned} copies."); + Logging.Debug($"[CardSystemManager] Added duplicate card '{card.Name}'. Now have {existingCard.CopiesOwned} copies."); } else { @@ -158,7 +159,7 @@ namespace Data.CardSystem playerInventory.AddCard(card); OnCardCollected?.Invoke(card); - Debug.Log($"[CardSystemManager] Added new card '{card.Name}' to collection."); + Logging.Debug($"[CardSystemManager] Added new card '{card.Name}' to collection."); } } @@ -197,7 +198,7 @@ namespace Data.CardSystem else { // Fallback if no cards of the selected rarity - Debug.LogWarning($"[CardSystemManager] No cards of rarity {rarity} available, selecting a random card instead."); + Logging.Warning($"[CardSystemManager] No cards of rarity {rarity} available, selecting a random card instead."); int randomIndex = UnityEngine.Random.Range(0, availableCards.Count); CardDefinition randomDef = availableCards[randomIndex]; diff --git a/Assets/Scripts/Data/CardSystem/CardVisualConfig.cs b/Assets/Scripts/Data/CardSystem/CardVisualConfig.cs index 85e1197e..178e2f90 100644 --- a/Assets/Scripts/Data/CardSystem/CardVisualConfig.cs +++ b/Assets/Scripts/Data/CardSystem/CardVisualConfig.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Core; using UnityEngine; namespace AppleHills.Data.CardSystem @@ -86,7 +87,7 @@ namespace AppleHills.Data.CardSystem return color; } - Debug.LogWarning($"[CardVisualConfig] No color mapping found for rarity {rarity}, using default"); + Logging.Warning($"[CardVisualConfig] No color mapping found for rarity {rarity}, using default"); return Color.white; } @@ -107,7 +108,7 @@ namespace AppleHills.Data.CardSystem return color; } - Debug.LogWarning($"[CardVisualConfig] No color mapping found for zone {zone}, using default"); + Logging.Warning($"[CardVisualConfig] No color mapping found for zone {zone}, using default"); return Color.white; } @@ -128,7 +129,7 @@ namespace AppleHills.Data.CardSystem return sprite; } - Debug.LogWarning($"[CardVisualConfig] No shape mapping found for zone {zone}"); + Logging.Warning($"[CardVisualConfig] No shape mapping found for zone {zone}"); return null; } diff --git a/Assets/Scripts/Dialogue/DialogueComponent.cs b/Assets/Scripts/Dialogue/DialogueComponent.cs index 0e18a733..c870b953 100644 --- a/Assets/Scripts/Dialogue/DialogueComponent.cs +++ b/Assets/Scripts/Dialogue/DialogueComponent.cs @@ -89,7 +89,7 @@ namespace Dialogue speechBubble.DisplayDialogueContent(content, HasAnyLines()); // Log the content type for debugging - Debug.Log($"Displaying content type: {content.ContentType} - {(content.ContentType == DialogueContentType.Text ? content.Text : content.Image?.name)}"); + Logging.Debug($"Displaying content type: {content.ContentType} - {(content.ContentType == DialogueContentType.Text ? content.Text : content.Image?.name)}"); } else { @@ -98,7 +98,7 @@ namespace Dialogue speechBubble.DisplayDialogueLine(line, HasAnyLines()); // Log for debugging - Debug.Log($"Displaying legacy text: {line}"); + Logging.Debug($"Displaying legacy text: {line}"); } } @@ -345,7 +345,7 @@ namespace Dialogue private void MoveToNextNode() { - Debug.Log("MoveToNextNode"); + Logging.Debug("MoveToNextNode"); // If there's no next node, complete the dialogue if (string.IsNullOrEmpty(currentNode.nextNodeID)) @@ -471,7 +471,7 @@ namespace Dialogue private void OnAnyItemSlotted(PickupItemData slotDefinition, PickupItemData slottedItem) { - Debug.Log("[DialogueComponent] OnAnyItemSlotted"); + Logging.Debug("[DialogueComponent] OnAnyItemSlotted"); // Only react if we're active and waiting on a slot if (!IsActive || IsCompleted || currentNode == null || diff --git a/Assets/Scripts/Examples/QuickAccessExample.cs b/Assets/Scripts/Examples/QuickAccessExample.cs index a7a5cb1d..6c113601 100644 --- a/Assets/Scripts/Examples/QuickAccessExample.cs +++ b/Assets/Scripts/Examples/QuickAccessExample.cs @@ -1,5 +1,6 @@ using UnityEngine; using AppleHills.Core; +using Core; namespace AppleHills.Examples { @@ -17,64 +18,64 @@ namespace AppleHills.Examples // Print info about the player if (player != null) { - Debug.Log($"[QuickAccessExample] Player found: {player.name}"); - Debug.Log($"[QuickAccessExample] Player position: {player.transform.position}"); + Logging.Debug($"[QuickAccessExample] Player found: {player.name}"); + Logging.Debug($"[QuickAccessExample] Player position: {player.transform.position}"); // Access player controller var playerController = QuickAccess.Instance.PlayerController; if (playerController != null) { - Debug.Log($"[QuickAccessExample] Player controller found on object"); + Logging.Debug($"[QuickAccessExample] Player controller found on object"); } else { - Debug.LogWarning($"[QuickAccessExample] Player controller not found"); + Logging.Warning($"[QuickAccessExample] Player controller not found"); } } else { - Debug.LogWarning($"[QuickAccessExample] Player not found in scene"); + Logging.Warning($"[QuickAccessExample] Player not found in scene"); } // Print info about the follower (Pulver) if (follower != null) { - Debug.Log($"[QuickAccessExample] Follower found: {follower.name}"); - Debug.Log($"[QuickAccessExample] Follower position: {follower.transform.position}"); + Logging.Debug($"[QuickAccessExample] Follower found: {follower.name}"); + Logging.Debug($"[QuickAccessExample] Follower position: {follower.transform.position}"); // Access follower controller var followerController = QuickAccess.Instance.FollowerController; if (followerController != null) { - Debug.Log($"[QuickAccessExample] Follower controller found on object"); + Logging.Debug($"[QuickAccessExample] Follower controller found on object"); } else { - Debug.LogWarning($"[QuickAccessExample] Follower controller not found"); + Logging.Warning($"[QuickAccessExample] Follower controller not found"); } } else { - Debug.LogWarning($"[QuickAccessExample] Follower not found in scene"); + Logging.Warning($"[QuickAccessExample] Follower not found in scene"); } // Access camera var camera = QuickAccess.Instance.MainCamera; if (camera != null) { - Debug.Log($"[QuickAccessExample] Main camera found: {camera.name}"); - Debug.Log($"[QuickAccessExample] Camera position: {camera.transform.position}"); + Logging.Debug($"[QuickAccessExample] Main camera found: {camera.name}"); + Logging.Debug($"[QuickAccessExample] Camera position: {camera.transform.position}"); } else { - Debug.LogWarning($"[QuickAccessExample] Main camera not found"); + Logging.Warning($"[QuickAccessExample] Main camera not found"); } // Access managers try { - Debug.Log($"[QuickAccessExample] Game Manager instance accessed: {QuickAccess.Instance.GameManager != null}"); - Debug.Log($"[QuickAccessExample] Input Manager instance accessed: {QuickAccess.Instance.InputManager != null}"); + Logging.Debug($"[QuickAccessExample] Game Manager instance accessed: {QuickAccess.Instance.GameManager != null}"); + Logging.Debug($"[QuickAccessExample] Input Manager instance accessed: {QuickAccess.Instance.InputManager != null}"); } catch (System.Exception e) { diff --git a/Assets/Scripts/Input/InputManager.cs b/Assets/Scripts/Input/InputManager.cs index b3c65272..ada4a561 100644 --- a/Assets/Scripts/Input/InputManager.cs +++ b/Assets/Scripts/Input/InputManager.cs @@ -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(); 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(); 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(); 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(); 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(); 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}"); } /// @@ -369,7 +370,7 @@ namespace Input } _overrideConsumers.Remove(consumer); - Debug.Log($"[InputManager] Override consumer unregistered: {consumer}"); + Logging.Debug($"[InputManager] Override consumer unregistered: {consumer}"); } /// @@ -379,7 +380,7 @@ namespace Input { _activeHoldConsumer = null; _overrideConsumers.Clear(); - Debug.Log("[InputManager] All override consumers cleared."); + Logging.Debug("[InputManager] All override consumers cleared."); } /// @@ -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; } diff --git a/Assets/Scripts/Input/PlayerTouchController.cs b/Assets/Scripts/Input/PlayerTouchController.cs index 6ac8c8cf..5b3af21b 100644 --- a/Assets/Scripts/Input/PlayerTouchController.cs +++ b/Assets/Scripts/Input/PlayerTouchController.cs @@ -1,6 +1,7 @@ using UnityEngine; using Pathfinding; using AppleHills.Core.Settings; +using Core; namespace Input { @@ -83,7 +84,7 @@ namespace Input public void OnTap(Vector2 worldPosition) { InterruptMoveTo(); - Debug.Log($"[PlayerTouchController] OnTap at {worldPosition}"); + Logging.Debug($"[PlayerTouchController] OnTap at {worldPosition}"); if (aiPath != null) { aiPath.enabled = true; @@ -102,7 +103,7 @@ namespace Input public void OnHoldStart(Vector2 worldPosition) { InterruptMoveTo(); - Debug.Log($"[PlayerTouchController] OnHoldStart at {worldPosition}"); + Logging.Debug($"[PlayerTouchController] OnHoldStart at {worldPosition}"); lastHoldPosition = worldPosition; isHolding = true; if (_settings.DefaultHoldMovementMode == HoldMovementMode.Pathfinding && @@ -139,7 +140,7 @@ namespace Input /// public void OnHoldEnd(Vector2 worldPosition) { - Debug.Log($"[PlayerTouchController] OnHoldEnd at {worldPosition}"); + Logging.Debug($"[PlayerTouchController] OnHoldEnd at {worldPosition}"); isHolding = false; directMoveVelocity = Vector3.zero; if (aiPath != null && _settings.DefaultHoldMovementMode == @@ -315,13 +316,13 @@ namespace Input { _isMoving = true; OnMovementStarted?.Invoke(); - Debug.Log("[PlayerTouchController] Movement started"); + Logging.Debug("[PlayerTouchController] Movement started"); } else if (!isCurrentlyMoving && _isMoving) { _isMoving = false; OnMovementStopped?.Invoke(); - Debug.Log("[PlayerTouchController] Movement stopped"); + Logging.Debug("[PlayerTouchController] Movement stopped"); } } diff --git a/Assets/Scripts/Interactions/Interactable.cs b/Assets/Scripts/Interactions/Interactable.cs index e2635782..521d3c1b 100644 --- a/Assets/Scripts/Interactions/Interactable.cs +++ b/Assets/Scripts/Interactions/Interactable.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using UnityEngine.Events; using System.Threading.Tasks; +using Core; namespace Interactions { @@ -100,10 +101,10 @@ namespace Interactions { if (!_isActive) { - Debug.Log($"[Interactable] Is disabled!"); + Logging.Debug($"[Interactable] Is disabled!"); return; } - Debug.Log($"[Interactable] OnTap at {worldPosition} on {gameObject.name}"); + Logging.Debug($"[Interactable] OnTap at {worldPosition} on {gameObject.name}"); // Start the interaction process asynchronously _ = TryInteractAsync(); @@ -129,7 +130,7 @@ namespace Interactions { if (_playerRef == null) { - Debug.Log($"[Interactable] Player character could not be found. Aborting interaction."); + Logging.Debug($"[Interactable] Player character could not be found. Aborting interaction."); interactionInterrupted.Invoke(); await DispatchEventAsync(InteractionEventType.InteractionInterrupted); return; @@ -372,9 +373,9 @@ namespace Interactions // Dispatch InteractingCharacterArrived event and WAIT for all actions to complete // This ensures we wait for any timeline animations to finish before proceeding - Debug.Log("[Interactable] Follower arrived, dispatching InteractingCharacterArrived event and waiting for completion"); + Logging.Debug("[Interactable] Follower arrived, dispatching InteractingCharacterArrived event and waiting for completion"); await DispatchEventAsync(InteractionEventType.InteractingCharacterArrived); - Debug.Log("[Interactable] All InteractingCharacterArrived actions completed, proceeding with interaction"); + Logging.Debug("[Interactable] All InteractingCharacterArrived actions completed, proceeding with interaction"); // Check if we have any components that might have paused the interaction flow bool hasTimelineActions = false; diff --git a/Assets/Scripts/Interactions/InteractionTimelineAction.cs b/Assets/Scripts/Interactions/InteractionTimelineAction.cs index b89feb64..18adb068 100644 --- a/Assets/Scripts/Interactions/InteractionTimelineAction.cs +++ b/Assets/Scripts/Interactions/InteractionTimelineAction.cs @@ -3,6 +3,7 @@ using UnityEngine; using UnityEngine.Playables; using System.Linq; using System.Threading.Tasks; +using Core; using Input; namespace Interactions @@ -156,7 +157,7 @@ namespace Interactions { if (timelineAsset == null) { - Debug.LogWarning("[InteractionTimelineAction] Timeline asset is null"); + Logging.Warning("[InteractionTimelineAction] Timeline asset is null"); return true; // Return true to continue the interaction flow } @@ -175,7 +176,7 @@ namespace Interactions } else { - Debug.LogWarning($"[InteractionTimelineAction] Could not find track named '{mapping.playerTrackName}' for player binding"); + Logging.Warning($"[InteractionTimelineAction] Could not find track named '{mapping.playerTrackName}' for player binding"); } } catch (Exception ex) @@ -195,7 +196,7 @@ namespace Interactions } else { - Debug.LogWarning($"[InteractionTimelineAction] Could not find track named '{mapping.pulverTrackName}' for follower binding"); + Logging.Warning($"[InteractionTimelineAction] Could not find track named '{mapping.pulverTrackName}' for follower binding"); } } catch (Exception ex) @@ -212,7 +213,7 @@ namespace Interactions playableDirector.stopped += OnPlayableDirectorStopped; // Log the timeline playback - Debug.Log($"[InteractionTimelineAction] Playing timeline {timelineAsset.name} for event {mapping.eventType}"); + Logging.Debug($"[InteractionTimelineAction] Playing timeline {timelineAsset.name} for event {mapping.eventType}"); // Play the timeline playableDirector.Play(); @@ -224,7 +225,7 @@ namespace Interactions bool result = await _currentPlaybackTCS.Task; // Log completion - Debug.Log($"[InteractionTimelineAction] Timeline {timelineAsset.name} playback completed with result: {result}"); + Logging.Debug($"[InteractionTimelineAction] Timeline {timelineAsset.name} playback completed with result: {result}"); // Clear the task completion source _currentPlaybackTCS = null; @@ -237,7 +238,7 @@ namespace Interactions if (director != playableDirector || _currentPlaybackTCS == null) return; - Debug.Log($"[InteractionTimelineAction] PlayableDirector stopped. Signaling completion."); + Logging.Debug($"[InteractionTimelineAction] PlayableDirector stopped. Signaling completion."); // Signal completion when the director stops _currentPlaybackTCS.TrySetResult(true); @@ -250,7 +251,7 @@ namespace Interactions // If the TCS still exists after timeout, complete it with failure if (_currentPlaybackTCS != null) { - Debug.LogWarning($"[InteractionTimelineAction] Timeline playback timed out after {timeoutDuration} seconds"); + Logging.Warning($"[InteractionTimelineAction] Timeline playback timed out after {timeoutDuration} seconds"); _currentPlaybackTCS.TrySetResult(false); } } diff --git a/Assets/Scripts/Interactions/ItemSlot.cs b/Assets/Scripts/Interactions/ItemSlot.cs index dfce4c21..4f179297 100644 --- a/Assets/Scripts/Interactions/ItemSlot.cs +++ b/Assets/Scripts/Interactions/ItemSlot.cs @@ -80,7 +80,7 @@ namespace Interactions protected override void OnCharacterArrived() { - Debug.Log("[ItemSlot] OnCharacterArrived"); + Logging.Debug("[ItemSlot] OnCharacterArrived"); var heldItemData = FollowerController.CurrentlyHeldItemData; var heldItemObj = FollowerController.GetHeldPickupObject(); diff --git a/Assets/Scripts/Interactions/Pickup.cs b/Assets/Scripts/Interactions/Pickup.cs index d07237fe..205f6f57 100644 --- a/Assets/Scripts/Interactions/Pickup.cs +++ b/Assets/Scripts/Interactions/Pickup.cs @@ -103,7 +103,7 @@ namespace Interactions protected virtual void OnCharacterArrived() { - Debug.Log("[Pickup] OnCharacterArrived"); + Logging.Debug("[Pickup] OnCharacterArrived"); var combinationResult = FollowerController.TryCombineItems(this, out var combinationResultItem); if (combinationResultItem != null) diff --git a/Assets/Scripts/LevelS/LevelSwitch.cs b/Assets/Scripts/LevelS/LevelSwitch.cs index 2db71097..a3f257dd 100644 --- a/Assets/Scripts/LevelS/LevelSwitch.cs +++ b/Assets/Scripts/LevelS/LevelSwitch.cs @@ -116,7 +116,7 @@ namespace LevelS private async void OnMenuConfirm() { - var progress = new Progress(p => Debug.Log($"Loading progress: {p * 100:F0}%")); + var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); await SceneManagerService.Instance.SwitchSceneAsync(switchData.targetLevelSceneName, progress); } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Bubbles/Bubble.cs b/Assets/Scripts/Minigames/DivingForPictures/Bubbles/Bubble.cs index b01aad7c..a54d911e 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Bubbles/Bubble.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Bubbles/Bubble.cs @@ -2,6 +2,7 @@ using System.Collections; using Pooling; using AppleHills.Core.Interfaces; +using Core; namespace Minigames.DivingForPictures { @@ -72,7 +73,7 @@ namespace Minigames.DivingForPictures StopBubbleBehavior(); // Debug log for troubleshooting - Debug.Log($"[Bubble] Paused bubble: {name}"); + Logging.Debug($"[Bubble] Paused bubble: {name}"); } /// @@ -86,7 +87,7 @@ namespace Minigames.DivingForPictures StartBubbleBehavior(); // Debug log for troubleshooting - Debug.Log($"[Bubble] Resumed bubble: {name}"); + Logging.Debug($"[Bubble] Resumed bubble: {name}"); } /// @@ -195,7 +196,7 @@ namespace Minigames.DivingForPictures BubblePool pool = FindFirstObjectByType(); if (pool != null) { - Debug.LogWarning("Bubble is missing its parent pool reference, finding pool as fallback"); + Logging.Warning("Bubble is missing its parent pool reference, finding pool as fallback"); pool.ReturnBubble(this); } else diff --git a/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubblePool.cs b/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubblePool.cs index c9df15e7..593ea636 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubblePool.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubblePool.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Core; +using UnityEngine; using Pooling; namespace Minigames.DivingForPictures @@ -36,7 +37,7 @@ namespace Minigames.DivingForPictures /// public override void LogPoolStats() { - Debug.Log($"[BubblePool] Pooled bubbles: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})"); + Logging.Debug($"[BubblePool] Pooled bubbles: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})"); } } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubbleSpawner.cs b/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubbleSpawner.cs index 0d4b702f..7ce8ba47 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubbleSpawner.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Bubbles/BubbleSpawner.cs @@ -2,6 +2,7 @@ using UnityEngine; using AppleHills.Core.Settings; using AppleHills.Core.Interfaces; +using Core; namespace Minigames.DivingForPictures { @@ -106,7 +107,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log("[BubbleSpawner] Paused"); + Logging.Debug("[BubbleSpawner] Paused"); } /// @@ -131,7 +132,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log("[BubbleSpawner] Resumed"); + Logging.Debug("[BubbleSpawner] Resumed"); } /// @@ -153,7 +154,7 @@ namespace Minigames.DivingForPictures if (_devSettings == null) return; _nextSpawnInterval = GetRandomizedInterval(); - Debug.Log($"[BubbleSpawner] Next spawn interval set to: {_nextSpawnInterval:F2}s"); + Logging.Debug($"[BubbleSpawner] Next spawn interval set to: {_nextSpawnInterval:F2}s"); } /// @@ -239,7 +240,7 @@ namespace Minigames.DivingForPictures bubble.speed *= _devSettings.BubbleSurfacingSpeedFactor; } - Debug.Log($"[BubbleSpawner] Started surfacing mode. Bubbles slowed to {_devSettings.BubbleSurfacingSpeedFactor * 100}% speed."); + Logging.Debug($"[BubbleSpawner] Started surfacing mode. Bubbles slowed to {_devSettings.BubbleSurfacingSpeedFactor * 100}% speed."); } /// @@ -258,7 +259,7 @@ namespace Minigames.DivingForPictures /// private IEnumerator SpawnBubblesRoutine() { - Debug.Log("[BubbleSpawner] Started bubble spawning coroutine"); + Logging.Debug("[BubbleSpawner] Started bubble spawning coroutine"); while (enabled && gameObject.activeInHierarchy && !_isPaused) { @@ -269,7 +270,7 @@ namespace Minigames.DivingForPictures _spawnCoroutine = null; - Debug.Log("[BubbleSpawner] Bubble spawning coroutine ended"); + Logging.Debug("[BubbleSpawner] Bubble spawning coroutine ended"); } } } \ No newline at end of file diff --git a/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs b/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs index 57430c1e..caad403d 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs @@ -8,6 +8,7 @@ using UnityEngine.Playables; using AppleHills.Core.Settings; using Utility; using AppleHills.Core.Interfaces; +using Core; using Input; using UI; using Minigames.DivingForPictures.PictureCamera; @@ -144,11 +145,11 @@ namespace Minigames.DivingForPictures pauseMenu.OnGamePaused += Pause; pauseMenu.OnGameResumed += DoResume; - Debug.Log("[DivingGameManager] Subscribed to PauseMenu events"); + Logging.Debug("[DivingGameManager] Subscribed to PauseMenu events"); } else { - Debug.LogWarning("[DivingGameManager] PauseMenu not found. Pause functionality won't work properly."); + Logging.Warning("[DivingGameManager] PauseMenu not found. Pause functionality won't work properly."); } // Register this manager with the global GameManager @@ -161,6 +162,7 @@ namespace Minigames.DivingForPictures if (SceneOrientationEnforcer.Instance != null) { SceneOrientationEnforcer.Instance.OnOrientationCorrect += InitializeGame; + SceneOrientationEnforcer.Instance.OnOrientationIncorrect += Pause; // If orientation is already correct, initialize right away // This prevents issues if the orientation was already correct before subscription @@ -171,7 +173,7 @@ namespace Minigames.DivingForPictures } else { - Debug.LogWarning("[DivingGameManager] SceneOrientationEnforcer not found. Initializing game immediately."); + Logging.Warning("[DivingGameManager] SceneOrientationEnforcer not found. Initializing game immediately."); InitializeGame(); } @@ -210,6 +212,7 @@ namespace Minigames.DivingForPictures if (SceneOrientationEnforcer.Instance != null) { SceneOrientationEnforcer.Instance.OnOrientationCorrect -= InitializeGame; + SceneOrientationEnforcer.Instance.OnOrientationIncorrect -= Pause; } // Unsubscribe from PauseMenu events @@ -294,11 +297,11 @@ namespace Minigames.DivingForPictures private void SpawnMonster(Transform spawnPoint) { - Debug.Log("Spawning monster: " + spawnPoint.name); + Logging.Debug("Spawning monster: " + spawnPoint.name); if (monsterPrefabs.Length == 0) { - Debug.LogWarning("No monster prefabs assigned to DivingGameManager."); + Logging.Warning("No monster prefabs assigned to DivingGameManager."); return; } @@ -359,7 +362,7 @@ namespace Minigames.DivingForPictures int remainingRopes = playerRopes.Length - currentRopeIndex; OnRopeBroken?.Invoke(remainingRopes); - Debug.Log($"[DivingGameManager] Rope broken! {remainingRopes} ropes remaining."); + Logging.Debug($"[DivingGameManager] Rope broken! {remainingRopes} ropes remaining."); } } @@ -379,7 +382,7 @@ namespace Minigames.DivingForPictures } else { - Debug.LogWarning($"[DivingGameManager] Rope at index {currentRopeIndex} is null!"); + Logging.Warning($"[DivingGameManager] Rope at index {currentRopeIndex} is null!"); } // Move to the next rope regardless if current was null @@ -406,7 +409,7 @@ namespace Minigames.DivingForPictures if (isGameOver) return; isGameOver = true; - Debug.Log("[DivingGameManager] Game Over! All ropes broken. Starting surfacing sequence..."); + Logging.Debug("[DivingGameManager] Game Over! All ropes broken. Starting surfacing sequence..."); // Fire game over event OnGameOver?.Invoke(); @@ -422,7 +425,7 @@ namespace Minigames.DivingForPictures { if (playerRopes == null || playerRopes.Length == 0) { - Debug.LogWarning("[DivingGameManager] No ropes assigned to break! Damage system won't work properly."); + Logging.Warning("[DivingGameManager] No ropes assigned to break! Damage system won't work properly."); return; } @@ -430,7 +433,7 @@ namespace Minigames.DivingForPictures { if (playerRopes[i] == null) { - Debug.LogWarning($"[DivingGameManager] Rope at index {i} is null!"); + Logging.Warning($"[DivingGameManager] Rope at index {i} is null!"); } } } @@ -456,7 +459,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log("[DivingGameManager] Rope system reset."); + Logging.Debug("[DivingGameManager] Rope system reset."); } /// @@ -510,7 +513,7 @@ namespace Minigames.DivingForPictures // Start coroutine to animate the rock falling offscreen StartCoroutine(MoveRockOffscreen(rockObject.transform)); - Debug.Log("[DivingGameManager] Disabled rock components and animating it offscreen"); + Logging.Debug("[DivingGameManager] Disabled rock components and animating it offscreen"); } // Handle the Player object - disable components and reset X position @@ -534,7 +537,7 @@ namespace Minigames.DivingForPictures // Start coroutine to reset X position to 0 over 1 second StartCoroutine(ResetPlayerPosition(playerObject.transform)); - Debug.Log("[DivingGameManager] Disabled player components (keeping Animator and PlayerBlinkBehavior) and resetting position"); + Logging.Debug("[DivingGameManager] Disabled player components (keeping Animator and PlayerBlinkBehavior) and resetting position"); } // 3. Find bubble spawner and slow down existing bubbles (no velocity management needed) @@ -566,7 +569,7 @@ namespace Minigames.DivingForPictures } surfacingSequenceCoroutine = StartCoroutine(SurfacingSequence()); - Debug.Log($"[DivingGameManager] Started surfacing with target velocity factor: {targetVelocityFactor}"); + Logging.Debug($"[DivingGameManager] Started surfacing with target velocity factor: {targetVelocityFactor}"); } /// @@ -580,7 +583,7 @@ namespace Minigames.DivingForPictures UnityEngine.Camera mainCamera = UnityEngine.Camera.main; if (mainCamera == null) { - Debug.LogWarning("[DivingGameManager] Cannot find main camera to calculate offscreen position"); + Logging.Warning("[DivingGameManager] Cannot find main camera to calculate offscreen position"); yield break; } @@ -648,7 +651,7 @@ namespace Minigames.DivingForPictures { // Tell it to stop spawning new tiles tileSpawner.StopSpawning(); - Debug.Log("[DivingGameManager] Stopped spawning new tiles after delay"); + Logging.Debug("[DivingGameManager] Stopped spawning new tiles after delay"); } } @@ -661,11 +664,11 @@ namespace Minigames.DivingForPictures if (surfacingTimeline != null) { surfacingTimeline.Play(); - Debug.Log("[DivingGameManager] Last tile left the screen, playing timeline"); + Logging.Debug("[DivingGameManager] Last tile left the screen, playing timeline"); } else { - Debug.LogWarning("[DivingGameManager] No surfacing timeline assigned!"); + Logging.Warning("[DivingGameManager] No surfacing timeline assigned!"); } } @@ -684,7 +687,7 @@ namespace Minigames.DivingForPictures activeMonsters.Clear(); // Final score could be saved to player prefs or other persistence - Debug.Log($"Final Score: {playerScore}"); + Logging.Debug($"Final Score: {playerScore}"); } /// @@ -747,7 +750,7 @@ namespace Minigames.DivingForPictures component.Pause(); } - Debug.Log($"[DivingGameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); + Logging.Debug($"[DivingGameManager] Registered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); } } @@ -760,7 +763,7 @@ namespace Minigames.DivingForPictures if (component != null && _pausableComponents.Contains(component)) { _pausableComponents.Remove(component); - Debug.Log($"[DivingGameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); + Logging.Debug($"[DivingGameManager] Unregistered pausable component: {(component as MonoBehaviour)?.name ?? "Unknown"}"); } } @@ -788,7 +791,7 @@ namespace Minigames.DivingForPictures if(turnOffGameInput) InputManager.Instance.SetInputMode(InputMode.UI); - Debug.Log($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components."); + Logging.Debug($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components."); } /// @@ -809,7 +812,7 @@ namespace Minigames.DivingForPictures // Change input mode to UI when menu is open InputManager.Instance.SetInputMode(InputMode.GameAndUI); - Debug.Log($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components."); + Logging.Debug($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components."); } #region Photo Sequence Methods @@ -819,7 +822,7 @@ namespace Minigames.DivingForPictures /// private void OnReverseAnimationStarted() { - Debug.Log("[DivingGameManager] Viewfinder animation entering reverse (zoom-out) phase"); + Logging.Debug("[DivingGameManager] Viewfinder animation entering reverse (zoom-out) phase"); } /// @@ -842,7 +845,7 @@ namespace Minigames.DivingForPictures // Store the proximity value at the time of tap for scoring _capturedProximity = proximity; - Debug.Log($"[DivingGameManager] Player tapped during animation! Proximity: {proximity:F2}"); + Logging.Debug($"[DivingGameManager] Player tapped during animation! Proximity: {proximity:F2}"); // Take the picture at the current proximity TakePicture(); @@ -883,7 +886,7 @@ namespace Minigames.DivingForPictures // Calculate total score int pointsAwarded = settings.BasePoints + proximityBonus + depthBonus; - Debug.Log($"[DivingGameManager] Picture score calculation: base={proximityBonus} (proximity={proximity:F2}), " + + Logging.Debug($"[DivingGameManager] Picture score calculation: base={proximityBonus} (proximity={proximity:F2}), " + $"depth bonus={depthBonus}, total={pointsAwarded}"); // Add score @@ -932,7 +935,7 @@ namespace Minigames.DivingForPictures _isPhotoSequenceActive = false; _currentPhotoTarget = null; - Debug.Log($"[DivingGameManager] Completed photo sequence with proximity score: {_capturedProximity:F2}"); + Logging.Debug($"[DivingGameManager] Completed photo sequence with proximity score: {_capturedProximity:F2}"); } /// @@ -956,10 +959,16 @@ namespace Minigames.DivingForPictures /// public void InitializeGame() { + if (_isGameInitialized) + { + DoResume(); + return; + } + // Prevent double initialization if (_isGameInitialized) return; - Debug.Log("[DivingGameManager] Initializing game"); + Logging.Debug("[DivingGameManager] Initializing game"); // Subscribe to tile spawned event TrenchTileSpawner tileSpawner = FindFirstObjectByType(); @@ -969,7 +978,7 @@ namespace Minigames.DivingForPictures } else { - Debug.LogWarning("No TrenchTileSpawner found in scene. Monster spawning won't work."); + Logging.Warning("No TrenchTileSpawner found in scene. Monster spawning won't work."); } // Mark as initialized @@ -1021,7 +1030,7 @@ namespace Minigames.DivingForPictures if (viewfinderManager != null) { viewfinderManager.ShowFullScreenViewfinder(); - Debug.Log($"[DivingGameManager] Player entered range of monster {monster.name}, showing full-screen viewfinder"); + Logging.Debug($"[DivingGameManager] Player entered range of monster {monster.name}, showing full-screen viewfinder"); } } } @@ -1036,7 +1045,7 @@ namespace Minigames.DivingForPictures if (viewfinderManager != null) { viewfinderManager.HideViewfinder(); - Debug.Log($"[DivingGameManager] Player exited range of monster {monster.name}, hiding viewfinder"); + Logging.Debug($"[DivingGameManager] Player exited range of monster {monster.name}, hiding viewfinder"); } // Clear current target @@ -1052,7 +1061,7 @@ namespace Minigames.DivingForPictures { // Pause the game immediately DoPause(false); - Debug.Log($"[DivingGameManager] Pausing game before starting viewfinder animation"); + Logging.Debug($"[DivingGameManager] Pausing game before starting viewfinder animation"); // Mark the photo sequence as active _isPhotoSequenceActive = true; @@ -1070,7 +1079,7 @@ namespace Minigames.DivingForPictures if (viewfinderManager != null) { viewfinderManager.StartViewfinderSequence(_currentPhotoTarget.transform); - Debug.Log($"[DivingGameManager] Viewfinder tapped for monster {_currentPhotoTarget.name}, starting animation sequence"); + Logging.Debug($"[DivingGameManager] Viewfinder tapped for monster {_currentPhotoTarget.name}, starting animation sequence"); } else { diff --git a/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs b/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs index 7b3b8784..7745d67a 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Monster/Monster.cs @@ -1,6 +1,7 @@ using UnityEngine; using System; using System.Collections; +using Core; namespace Minigames.DivingForPictures { @@ -29,7 +30,7 @@ namespace Minigames.DivingForPictures private void Awake() { - Debug.Log("Monster created: " + gameObject.name); + Logging.Debug("Monster created: " + gameObject.name); if (detectionCollider == null) detectionCollider = GetComponent(); @@ -48,7 +49,7 @@ namespace Minigames.DivingForPictures private void OnDestroy() { - Debug.Log("Monster destroyed: " + gameObject.name); + Logging.Debug("Monster destroyed: " + gameObject.name); } private IEnumerator CheckIfOffScreen() diff --git a/Assets/Scripts/Minigames/DivingForPictures/Obstacles/FloatingObstacle.cs b/Assets/Scripts/Minigames/DivingForPictures/Obstacles/FloatingObstacle.cs index a6fd12e9..df5a7c4e 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Obstacles/FloatingObstacle.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Obstacles/FloatingObstacle.cs @@ -4,6 +4,7 @@ using AppleHills.Core.Settings; using Pooling; using Utils; using AppleHills.Core.Interfaces; +using Core; namespace Minigames.DivingForPictures { @@ -84,7 +85,7 @@ namespace Minigames.DivingForPictures _settings = GameManager.GetSettingsObject(); if (_settings == null) { - Debug.LogWarning("[FloatingObstacle] Could not retrieve settings, using default values"); + Logging.Warning("[FloatingObstacle] Could not retrieve settings, using default values"); _baseMoveSpeed = moveSpeed; // Use the serialized value as fallback } else @@ -95,7 +96,7 @@ namespace Minigames.DivingForPictures // For variety, randomly assign a speed between min and max _baseMoveSpeed = Random.Range(minSpeed, maxSpeed); - Debug.Log($"[FloatingObstacle] Initialized with normalized speed: {_baseMoveSpeed} (range: {minSpeed}-{maxSpeed})"); + Logging.Debug($"[FloatingObstacle] Initialized with normalized speed: {_baseMoveSpeed} (range: {minSpeed}-{maxSpeed})"); } // Calculate screen normalization factor @@ -117,7 +118,7 @@ namespace Minigames.DivingForPictures // Calculate normalization factor based on screen height _screenNormalizationFactor = Screen.height / referenceHeight; - Debug.Log($"[FloatingObstacle] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})"); + Logging.Debug($"[FloatingObstacle] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})"); } private void OnEnable() @@ -147,7 +148,7 @@ namespace Minigames.DivingForPictures _isPaused = true; StopObstacleCoroutines(); - Debug.Log($"[FloatingObstacle] Paused obstacle: {name}"); + Logging.Debug($"[FloatingObstacle] Paused obstacle: {name}"); } /// @@ -160,7 +161,7 @@ namespace Minigames.DivingForPictures _isPaused = false; StartObstacleCoroutines(); - Debug.Log($"[FloatingObstacle] Resumed obstacle: {name}"); + Logging.Debug($"[FloatingObstacle] Resumed obstacle: {name}"); } /// @@ -221,7 +222,7 @@ namespace Minigames.DivingForPictures _movementCoroutine = StartCoroutine(MovementCoroutine()); } - Debug.Log($"[FloatingObstacle] {gameObject.name} velocity factor updated to {_velocityFactor:F2}, normalized speed: {moveSpeed:F2}"); + Logging.Debug($"[FloatingObstacle] {gameObject.name} velocity factor updated to {_velocityFactor:F2}, normalized speed: {moveSpeed:F2}"); } /// @@ -229,7 +230,7 @@ namespace Minigames.DivingForPictures /// private IEnumerator MovementCoroutine() { - Debug.Log($"[FloatingObstacle] Started movement coroutine with speed: {_baseMoveSpeed:F3}"); + Logging.Debug($"[FloatingObstacle] Started movement coroutine with speed: {_baseMoveSpeed:F3}"); while (enabled && gameObject.activeInHierarchy) { @@ -273,7 +274,7 @@ namespace Minigames.DivingForPictures if (_collider != null && _collider.enabled) { _collider.enabled = false; - Debug.Log($"[FloatingObstacle] Obstacle {gameObject.name} hit player - collider disabled"); + Logging.Debug($"[FloatingObstacle] Obstacle {gameObject.name} hit player - collider disabled"); } } @@ -299,12 +300,12 @@ namespace Minigames.DivingForPictures // Use a larger buffer to ensure obstacles are truly off-screen before returning to pool if (transform.position.y > _screenTop + 5f) { - Debug.Log($"[FloatingObstacle] {gameObject.name} off-screen at Y:{transform.position.y:F2}, screen top:{_screenTop:F2}"); + Logging.Debug($"[FloatingObstacle] {gameObject.name} off-screen at Y:{transform.position.y:F2}, screen top:{_screenTop:F2}"); ReturnToPool(); } else if (transform.position.y < _screenBottom - 5f) // Added check for bottom screen edge { - Debug.Log($"[FloatingObstacle] {gameObject.name} below screen at Y:{transform.position.y:F2}, screen bottom:{_screenBottom:F2}"); + Logging.Debug($"[FloatingObstacle] {gameObject.name} below screen at Y:{transform.position.y:F2}, screen bottom:{_screenBottom:F2}"); ReturnToPool(); } } @@ -328,14 +329,14 @@ namespace Minigames.DivingForPictures ObstacleSpawner foundSpawner = FindFirstObjectByType(); if (foundSpawner != null) { - Debug.LogWarning($"[FloatingObstacle] Obstacle {gameObject.name} lost spawner reference, found replacement spawner"); + Logging.Warning($"[FloatingObstacle] Obstacle {gameObject.name} lost spawner reference, found replacement spawner"); spawner = foundSpawner; spawner.ReturnObstacleToPool(gameObject, prefabIndex); } else { // No spawner found - just deactivate the object instead of destroying it - Debug.LogWarning($"[FloatingObstacle] No spawner found for {gameObject.name}, deactivating safely"); + Logging.Warning($"[FloatingObstacle] No spawner found for {gameObject.name}, deactivating safely"); gameObject.SetActive(false); // Move to a safe location to avoid interference @@ -368,7 +369,7 @@ namespace Minigames.DivingForPictures _collider.enabled = true; } - Debug.Log($"[FloatingObstacle] Obstacle {gameObject.name} spawned from pool"); + Logging.Debug($"[FloatingObstacle] Obstacle {gameObject.name} spawned from pool"); // Note: Don't start coroutines here - OnEnable() will handle that when SetActive(true) is called } @@ -387,7 +388,7 @@ namespace Minigames.DivingForPictures _collider.enabled = true; } - Debug.Log($"[FloatingObstacle] Obstacle {gameObject.name} despawned to pool"); + Logging.Debug($"[FloatingObstacle] Obstacle {gameObject.name} despawned to pool"); } /// @@ -427,7 +428,7 @@ namespace Minigames.DivingForPictures // Reverse movement speed (already handled by ObstacleSpawner, but this ensures consistency) moveSpeed *= -1; - Debug.Log($"[FloatingObstacle] {gameObject.name} started surfacing with speed: {moveSpeed}"); + Logging.Debug($"[FloatingObstacle] {gameObject.name} started surfacing with speed: {moveSpeed}"); } } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstaclePool.cs b/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstaclePool.cs index d11a77fa..9f30ae27 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstaclePool.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstaclePool.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Core; +using UnityEngine; using Pooling; namespace Minigames.DivingForPictures @@ -21,12 +22,12 @@ namespace Minigames.DivingForPictures FloatingObstacle obstacleComponent = obstacle.GetComponent(); if (obstacleComponent != null) { - Debug.Log($"[ObstaclePool] Returning obstacle {obstacle.name} to pool"); + Logging.Debug($"[ObstaclePool] Returning obstacle {obstacle.name} to pool"); Return(obstacleComponent, prefabIndex); } else { - Debug.LogWarning($"Attempted to return a GameObject without a FloatingObstacle component: {obstacle.name}"); + Logging.Warning($"Attempted to return a GameObject without a FloatingObstacle component: {obstacle.name}"); Destroy(obstacle); } } @@ -38,7 +39,7 @@ namespace Minigames.DivingForPictures /// An obstacle instance ready to use public GameObject GetObstacle(int prefabIndex) { - Debug.Log($"[ObstaclePool] GetObstacle called for prefab index {prefabIndex}"); + Logging.Debug($"[ObstaclePool] GetObstacle called for prefab index {prefabIndex}"); FloatingObstacle obstacleComponent = Get(prefabIndex); if (obstacleComponent == null) @@ -47,7 +48,7 @@ namespace Minigames.DivingForPictures return null; } - Debug.Log($"[ObstaclePool] Get() returned obstacle {obstacleComponent.name}, active state: {obstacleComponent.gameObject.activeInHierarchy}"); + Logging.Debug($"[ObstaclePool] Get() returned obstacle {obstacleComponent.name}, active state: {obstacleComponent.gameObject.activeInHierarchy}"); return obstacleComponent.gameObject; } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstacleSpawner.cs b/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstacleSpawner.cs index 65dc729a..3f4711d1 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstacleSpawner.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Obstacles/ObstacleSpawner.cs @@ -5,6 +5,7 @@ using UnityEngine.Events; using Pooling; using AppleHills.Core.Settings; using AppleHills.Core.Interfaces; +using Core; namespace Minigames.DivingForPictures { @@ -119,7 +120,7 @@ namespace Minigames.DivingForPictures StartMoveCoroutine(); StartDespawnCoroutine(); - Debug.Log("[ObstacleSpawner] Initialized"); + Logging.Debug("[ObstacleSpawner] Initialized"); } /// @@ -151,7 +152,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log($"[ObstacleSpawner] Paused with {_activeObstacles.Count} active obstacles"); + Logging.Debug($"[ObstacleSpawner] Paused with {_activeObstacles.Count} active obstacles"); } /// @@ -182,7 +183,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log($"[ObstacleSpawner] Resumed with {_activeObstacles.Count} active obstacles"); + Logging.Debug($"[ObstacleSpawner] Resumed with {_activeObstacles.Count} active obstacles"); } /// @@ -232,14 +233,14 @@ namespace Minigames.DivingForPictures // Check if the prefab has a FloatingObstacle component if (obstaclePrefabs[i].GetComponent() == null) { - Debug.LogWarning($"Obstacle prefab {obstaclePrefabs[i].name} does not have a FloatingObstacle component. Adding one automatically."); + Logging.Warning($"Obstacle prefab {obstaclePrefabs[i].name} does not have a FloatingObstacle component. Adding one automatically."); obstaclePrefabs[i].AddComponent(); } // Ensure the prefab is on the correct layer (using configurable obstacleLayer) if (obstaclePrefabs[i].layer != _devSettings.ObstacleLayer) { - Debug.LogWarning($"Obstacle prefab {obstaclePrefabs[i].name} is not on the configured obstacle layer ({_devSettings.ObstacleLayer}). Setting layer automatically."); + Logging.Warning($"Obstacle prefab {obstaclePrefabs[i].name} is not on the configured obstacle layer ({_devSettings.ObstacleLayer}). Setting layer automatically."); SetLayerRecursively(obstaclePrefabs[i], _devSettings.ObstacleLayer); } } @@ -319,7 +320,7 @@ namespace Minigames.DivingForPictures // Calculate spawn range based on 80% of screen width (40% on each side from center) _spawnRangeX = (screenWidth * 0.8f) / 2f; - Debug.Log($"[ObstacleSpawner] Screen calculated - Width: {screenWidth:F2}, Bottom: {_screenBottom:F2}, Spawn Range X: ±{_spawnRangeX:F2}"); + Logging.Debug($"[ObstacleSpawner] Screen calculated - Width: {screenWidth:F2}, Bottom: {_screenBottom:F2}, Spawn Range X: ±{_spawnRangeX:F2}"); } /// @@ -330,7 +331,7 @@ namespace Minigames.DivingForPictures if (_spawnCoroutine == null) { _spawnCoroutine = StartCoroutine(SpawnObstaclesCoroutine()); - Debug.Log("[ObstacleSpawner] Started spawning obstacles"); + Logging.Debug("[ObstacleSpawner] Started spawning obstacles"); } } @@ -343,7 +344,7 @@ namespace Minigames.DivingForPictures { StopCoroutine(_spawnCoroutine); _spawnCoroutine = null; - Debug.Log("[ObstacleSpawner] Stopped spawning obstacles"); + Logging.Debug("[ObstacleSpawner] Stopped spawning obstacles"); } } @@ -375,15 +376,15 @@ namespace Minigames.DivingForPictures // Don't spawn new obstacles when surfacing if (_isSurfacing) { - Debug.Log("[ObstacleSpawner] Skipping obstacle spawn - currently surfacing"); + Logging.Debug("[ObstacleSpawner] Skipping obstacle spawn - currently surfacing"); return; } - Debug.Log($"[ObstacleSpawner] TrySpawnObstacle called at {Time.time:F2}"); + Logging.Debug($"[ObstacleSpawner] TrySpawnObstacle called at {Time.time:F2}"); if (obstaclePrefabs == null || obstaclePrefabs.Count == 0) { - Debug.LogWarning("[ObstacleSpawner] No obstacle prefabs available for spawning!"); + Logging.Warning("[ObstacleSpawner] No obstacle prefabs available for spawning!"); return; } @@ -397,20 +398,20 @@ namespace Minigames.DivingForPictures if (IsValidSpawnPosition(spawnPosition)) { - Debug.Log($"[ObstacleSpawner] Found valid position at {spawnPosition} after {attempts + 1} attempts"); + Logging.Debug($"[ObstacleSpawner] Found valid position at {spawnPosition} after {attempts + 1} attempts"); SpawnObstacleAt(spawnPosition); foundValidPosition = true; break; } else { - Debug.Log($"[ObstacleSpawner] Position {spawnPosition} invalid (attempt {attempts + 1}/{_settings.ObstacleMaxSpawnAttempts})"); + Logging.Debug($"[ObstacleSpawner] Position {spawnPosition} invalid (attempt {attempts + 1}/{_settings.ObstacleMaxSpawnAttempts})"); } } if (!foundValidPosition) { - Debug.LogWarning($"[ObstacleSpawner] SPAWN MISSED: Could not find valid spawn position after {_settings.ObstacleMaxSpawnAttempts} attempts at {Time.time:F2}"); + Logging.Warning($"[ObstacleSpawner] SPAWN MISSED: Could not find valid spawn position after {_settings.ObstacleMaxSpawnAttempts} attempts at {Time.time:F2}"); } } @@ -443,7 +444,7 @@ namespace Minigames.DivingForPictures /// private void SpawnObstacleAt(Vector3 position) { - Debug.Log($"[ObstacleSpawner] SpawnObstacleAt called for position {position}"); + Logging.Debug($"[ObstacleSpawner] SpawnObstacleAt called for position {position}"); // Select random prefab int prefabIndex = Random.Range(0, obstaclePrefabs.Count); @@ -460,7 +461,7 @@ namespace Minigames.DivingForPictures // Spawn using pool or instantiate directly if (_devSettings.ObstacleUseObjectPooling && _obstaclePool != null) { - Debug.Log($"[ObstacleSpawner] Requesting obstacle from pool (prefab index {prefabIndex})"); + Logging.Debug($"[ObstacleSpawner] Requesting obstacle from pool (prefab index {prefabIndex})"); obstacle = _obstaclePool.GetObstacle(prefabIndex); if (obstacle == null) { @@ -473,12 +474,12 @@ namespace Minigames.DivingForPictures obstacle.transform.rotation = prefab.transform.rotation; obstacle.transform.SetParent(transform); - Debug.Log($"[ObstacleSpawner] Got obstacle {obstacle.name} from pool, active state: {obstacle.activeInHierarchy}"); + Logging.Debug($"[ObstacleSpawner] Got obstacle {obstacle.name} from pool, active state: {obstacle.activeInHierarchy}"); // ENHANCED FORCE ACTIVATION - more robust approach if (!obstacle.activeInHierarchy) { - Debug.LogWarning($"[ObstacleSpawner] Pool returned inactive object {obstacle.name}, force activating!"); + Logging.Warning($"[ObstacleSpawner] Pool returned inactive object {obstacle.name}, force activating!"); // Configure obstacle BEFORE activation ConfigureObstacle(obstacle, prefabIndex); @@ -500,7 +501,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log($"[ObstacleSpawner] After force activation, {obstacle.name} active state: {obstacle.activeInHierarchy}"); + Logging.Debug($"[ObstacleSpawner] After force activation, {obstacle.name} active state: {obstacle.activeInHierarchy}"); } else { @@ -510,7 +511,7 @@ namespace Minigames.DivingForPictures } else { - Debug.Log($"[ObstacleSpawner] Instantiating new obstacle (pooling disabled)"); + Logging.Debug($"[ObstacleSpawner] Instantiating new obstacle (pooling disabled)"); obstacle = Instantiate(prefab, position, prefab.transform.rotation, transform); // Configure the newly instantiated obstacle @@ -521,16 +522,16 @@ namespace Minigames.DivingForPictures _obstacleCounter++; string oldName = obstacle.name; obstacle.name = $"Obstacle{_obstacleCounter:D3}"; - Debug.Log($"[ObstacleSpawner] Renamed obstacle from '{oldName}' to '{obstacle.name}', active state: {obstacle.activeInHierarchy}"); + Logging.Debug($"[ObstacleSpawner] Renamed obstacle from '{oldName}' to '{obstacle.name}', active state: {obstacle.activeInHierarchy}"); // Track active obstacles _activeObstacles.Add(obstacle); // Invoke events onObstacleSpawned?.Invoke(obstacle); - Debug.Log($"[ObstacleSpawner] After events, obstacle {obstacle.name} active state: {obstacle.activeInHierarchy}"); + Logging.Debug($"[ObstacleSpawner] After events, obstacle {obstacle.name} active state: {obstacle.activeInHierarchy}"); - Debug.Log($"[ObstacleSpawner] Successfully spawned obstacle {obstacle.name} at {position}. Active count: {_activeObstacles.Count}, Final active state: {obstacle.activeInHierarchy}"); + Logging.Debug($"[ObstacleSpawner] Successfully spawned obstacle {obstacle.name} at {position}. Active count: {_activeObstacles.Count}, Final active state: {obstacle.activeInHierarchy}"); } /// @@ -567,7 +568,7 @@ namespace Minigames.DivingForPictures { if (obstacle == null) return; - Debug.Log($"[ObstacleSpawner] ReturnObstacleToPool called for {obstacle.name}, active state: {obstacle.activeInHierarchy}"); + Logging.Debug($"[ObstacleSpawner] ReturnObstacleToPool called for {obstacle.name}, active state: {obstacle.activeInHierarchy}"); // Remove from active list _activeObstacles.Remove(obstacle); @@ -578,12 +579,12 @@ namespace Minigames.DivingForPictures // Return to pool or destroy if (_devSettings.ObstacleUseObjectPooling && _obstaclePool != null) { - Debug.Log($"[ObstacleSpawner] Returning {obstacle.name} to pool"); + Logging.Debug($"[ObstacleSpawner] Returning {obstacle.name} to pool"); _obstaclePool.ReturnObstacle(obstacle, prefabIndex); } else { - Debug.Log($"[ObstacleSpawner] Destroying {obstacle.name} (pooling disabled)"); + Logging.Debug($"[ObstacleSpawner] Destroying {obstacle.name} (pooling disabled)"); Destroy(obstacle); } } @@ -595,7 +596,7 @@ namespace Minigames.DivingForPictures { // This method can no longer directly modify the settings // Consider implementing a runtime settings override system if needed - Debug.LogWarning("[ObstacleSpawner] SetSpawnInterval no longer modifies settings directly. Settings are now centralized."); + Logging.Warning("[ObstacleSpawner] SetSpawnInterval no longer modifies settings directly. Settings are now centralized."); } /// @@ -605,7 +606,7 @@ namespace Minigames.DivingForPictures { // This method can no longer directly modify the settings // Consider implementing a runtime settings override system if needed - Debug.LogWarning("[ObstacleSpawner] SetSpeedRange no longer modifies settings directly. Settings are now centralized."); + Logging.Warning("[ObstacleSpawner] SetSpeedRange no longer modifies settings directly. Settings are now centralized."); } /// @@ -636,7 +637,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log($"[ObstacleSpawner] Velocity factor updated to {_velocityFactor:F2}, propagated to {_activeObstacles.Count} active obstacles"); + Logging.Debug($"[ObstacleSpawner] Velocity factor updated to {_velocityFactor:F2}, propagated to {_activeObstacles.Count} active obstacles"); } /// @@ -662,7 +663,7 @@ namespace Minigames.DivingForPictures } } - Debug.Log($"[ObstacleSpawner] Started surfacing mode for {_activeObstacles.Count} active obstacles"); + Logging.Debug($"[ObstacleSpawner] Started surfacing mode for {_activeObstacles.Count} active obstacles"); } /// @@ -675,7 +676,7 @@ namespace Minigames.DivingForPictures /// private IEnumerator SpawnObstacleRoutine() { - Debug.Log("[ObstacleSpawner] Started spawning coroutine"); + Logging.Debug("[ObstacleSpawner] Started spawning coroutine"); while (enabled && gameObject.activeInHierarchy && !_isPaused && !_isSurfacing) { @@ -694,7 +695,7 @@ namespace Minigames.DivingForPictures // Clear coroutine reference when stopped _spawnCoroutine = null; - Debug.Log("[ObstacleSpawner] Spawning coroutine ended"); + Logging.Debug("[ObstacleSpawner] Spawning coroutine ended"); } /// @@ -704,7 +705,7 @@ namespace Minigames.DivingForPictures /// private IEnumerator MoveObstaclesRoutine() { - Debug.Log("[ObstacleSpawner] Started obstacle monitoring coroutine"); + Logging.Debug("[ObstacleSpawner] Started obstacle monitoring coroutine"); // This coroutine now just monitors obstacles, not moves them while (enabled && gameObject.activeInHierarchy && !_isPaused) @@ -718,7 +719,7 @@ namespace Minigames.DivingForPictures // Clear coroutine reference when stopped _moveCoroutine = null; - Debug.Log("[ObstacleSpawner] Obstacle monitoring coroutine ended"); + Logging.Debug("[ObstacleSpawner] Obstacle monitoring coroutine ended"); } /// @@ -727,7 +728,7 @@ namespace Minigames.DivingForPictures private IEnumerator DespawnObstaclesRoutine() { const float checkInterval = 0.5f; // Check every half second - Debug.Log("[ObstacleSpawner] Started despawn coroutine with interval: " + checkInterval); + Logging.Debug("[ObstacleSpawner] Started despawn coroutine with interval: " + checkInterval); while (enabled && gameObject.activeInHierarchy && !_isPaused) { @@ -808,7 +809,7 @@ namespace Minigames.DivingForPictures // Clear coroutine reference when stopped _despawnCoroutine = null; - Debug.Log("[ObstacleSpawner] Despawn coroutine ended"); + Logging.Debug("[ObstacleSpawner] Despawn coroutine ended"); } #if UNITY_EDITOR diff --git a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs index 77be19dc..9d943a19 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/CameraViewfinderManager.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using AppleHills.Core.Settings; +using Core; namespace Minigames.DivingForPictures.PictureCamera { @@ -206,7 +207,7 @@ namespace Minigames.DivingForPictures.PictureCamera float canvasWidth = canvasRect.rect.width; targetViewfinderSize = canvasWidth * 0.25f; - Debug.LogWarning("[CameraViewfinderManager] No SpriteRenderer found on target, using default size"); + Logging.Warning("[CameraViewfinderManager] No SpriteRenderer found on target, using default size"); return; } @@ -290,7 +291,7 @@ namespace Minigames.DivingForPictures.PictureCamera RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, targetScreenPosition, uiCamera, out targetAnchoredPosition); - Debug.Log( + Logging.Debug( $"[CameraViewfinderManager] Target size (canvas): {targetViewfinderSize}, target anchored: {targetAnchoredPosition}"); } @@ -331,7 +332,7 @@ namespace Minigames.DivingForPictures.PictureCamera bool[] thresholdTriggered = new bool[settings.ViewfinderProgressThresholds.Length]; // Debug the actual values - Debug.Log($"[CameraViewfinderManager] Animation starting: startSize={startSize}, endSize={endSize}, " + + Logging.Debug($"[CameraViewfinderManager] Animation starting: startSize={startSize}, endSize={endSize}, " + $"current sizeDelta={viewfinderRectTransform.sizeDelta}"); // Verify the initial size is set correctly @@ -358,7 +359,7 @@ namespace Minigames.DivingForPictures.PictureCamera // Additional check to ensure size is actually shrinking if (startSize > endSize && currentSize > startSize) { - Debug.LogWarning($"[CameraViewfinderManager] Animation curve producing wrong direction! " + + Logging.Warning($"[CameraViewfinderManager] Animation curve producing wrong direction! " + $"progress={animationProgress:F2}, curveValue={curveValue:F2}"); // Force correct behavior curveValue = animationProgress; // Override with linear interpolation @@ -376,7 +377,7 @@ namespace Minigames.DivingForPictures.PictureCamera // Log the animation state occasionally for debugging if (animationProgress % 0.25f <= 0.01f || animationProgress >= 0.99f) { - Debug.Log($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " + + Logging.Debug($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " + $"curveValue={curveValue:F2}, currentSize={currentSize:F2}, currentPos={newPos}"); } @@ -401,7 +402,7 @@ namespace Minigames.DivingForPictures.PictureCamera OnAnimationCompleted?.Invoke(); // Log final state to confirm we reached the target size - Debug.Log( + Logging.Debug( $"[CameraViewfinderManager] Animation completed: final size={viewfinderRectTransform.sizeDelta}"); yield return new WaitForSecondsRealtime(0.5f); @@ -471,7 +472,7 @@ namespace Minigames.DivingForPictures.PictureCamera viewfinderInstance = null; viewfinderComponent = null; viewfinderRectTransform = null; - Debug.Log("[CameraViewfinderManager] Hid viewfinder"); + Logging.Debug("[CameraViewfinderManager] Hid viewfinder"); } } @@ -532,7 +533,7 @@ namespace Minigames.DivingForPictures.PictureCamera viewfinderRectTransform.sizeDelta = new Vector2(canvasWidth, canvasWidth); viewfinderRectTransform.anchoredPosition = Vector2.zero; - Debug.Log($"[CameraViewfinderManager] Showed full-screen viewfinder with size {canvasWidth}"); + Logging.Debug($"[CameraViewfinderManager] Showed full-screen viewfinder with size {canvasWidth}"); } /// @@ -651,7 +652,7 @@ namespace Minigames.DivingForPictures.PictureCamera bool[] thresholdTriggered = new bool[settings.ViewfinderProgressThresholds.Length]; // Debug the actual values - Debug.Log($"[CameraViewfinderManager] Animation sequence starting: startSize={startSize}, endSize={endSize}"); + Logging.Debug($"[CameraViewfinderManager] Animation sequence starting: startSize={startSize}, endSize={endSize}"); // Verify the initial size is set correctly viewfinderRectTransform.sizeDelta = new Vector2(startSize, startSize); @@ -687,7 +688,7 @@ namespace Minigames.DivingForPictures.PictureCamera // Log the animation state occasionally for debugging if (animationProgress % 0.25f <= 0.01f || animationProgress >= 0.99f) { - Debug.Log($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " + + Logging.Debug($"[CameraViewfinderManager] Animation progress: {animationProgress:F2}, " + $"curveValue={curveValue:F2}, currentSize={currentSize:F2}, currentPos={newPos}, proximity={currentProximity:F2}"); } @@ -752,7 +753,7 @@ namespace Minigames.DivingForPictures.PictureCamera // Log the animation state occasionally for debugging if (animationProgress % 0.25f <= 0.01f || animationProgress >= 0.99f) { - Debug.Log($"[CameraViewfinderManager] Reverse animation progress: {animationProgress:F2}, " + + Logging.Debug($"[CameraViewfinderManager] Reverse animation progress: {animationProgress:F2}, " + $"curveValue={curveValue:F2}, currentSize={currentSize:F2}, currentPos={newPos}, proximity={currentProximity:F2}"); } @@ -835,7 +836,7 @@ namespace Minigames.DivingForPictures.PictureCamera { // Start the photo sequence when hold begins (same behavior as first tap in tap mode) OnViewfinderTapped?.Invoke(); - Debug.Log("[CameraViewfinderManager] Hold started - initiating photo sequence"); + Logging.Debug("[CameraViewfinderManager] Hold started - initiating photo sequence"); } } @@ -848,7 +849,7 @@ namespace Minigames.DivingForPictures.PictureCamera { // Complete the sequence when hold ends (same behavior as second tap in tap mode) OnViewfinderTappedDuringAnimation?.Invoke(currentProximity); - Debug.Log("[CameraViewfinderManager] Hold ended - completing photo sequence with proximity: " + currentProximity); + Logging.Debug("[CameraViewfinderManager] Hold ended - completing photo sequence with proximity: " + currentProximity); // Complete the animation immediately if (animationCoroutine != null) diff --git a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs index 63e85c28..cf0e9d22 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/PictureCamera/Viewfinder.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Core; +using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using Input; @@ -99,7 +100,7 @@ namespace Minigames.DivingForPictures.PictureCamera { // Fire the tap event that PhotoSequenceController will listen to OnViewfinderTapped?.Invoke(); - Debug.Log($"[MDPI] Viewfinder OnTap: {position}"); + Logging.Debug($"[MDPI] Viewfinder OnTap: {position}"); } } @@ -109,7 +110,7 @@ namespace Minigames.DivingForPictures.PictureCamera { // Fire the hold start event OnViewfinderHoldStarted?.Invoke(); - Debug.Log($"[MDPI] Viewfinder OnHoldStart: {position}"); + Logging.Debug($"[MDPI] Viewfinder OnHoldStart: {position}"); } } @@ -124,7 +125,7 @@ namespace Minigames.DivingForPictures.PictureCamera { // Fire the hold end event OnViewfinderHoldEnded?.Invoke(); - Debug.Log($"[MDPI] Viewfinder OnHoldEnd: {position}"); + Logging.Debug($"[MDPI] Viewfinder OnHoldEnd: {position}"); } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Player/ObstacleCollision.cs b/Assets/Scripts/Minigames/DivingForPictures/Player/ObstacleCollision.cs index fb333584..f6116c5b 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Player/ObstacleCollision.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Player/ObstacleCollision.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using Core; +using UnityEngine; namespace Minigames.DivingForPictures { @@ -32,7 +33,7 @@ namespace Minigames.DivingForPictures if (obstacle.gameObject.layer != _devSettings.ObstacleLayer) { // If not on the obstacle layer, don't process the collision - Debug.Log($"[ObstacleCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.ObstacleLayer})"); + Logging.Debug($"[ObstacleCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.ObstacleLayer})"); return; } @@ -43,7 +44,7 @@ namespace Minigames.DivingForPictures obstacleComponent.MarkDamageDealt(); } - Debug.Log($"[ObstacleCollision] Player hit by obstacle {obstacle.gameObject.name}"); + Logging.Debug($"[ObstacleCollision] Player hit by obstacle {obstacle.gameObject.name}"); } /// @@ -51,7 +52,7 @@ namespace Minigames.DivingForPictures /// private void HandleImmunityStarted() { - Debug.Log($"[ObstacleCollision] Damage immunity started for {_gameSettings.DamageImmunityDuration} seconds"); + Logging.Debug($"[ObstacleCollision] Damage immunity started for {_gameSettings.DamageImmunityDuration} seconds"); // Don't block input for obstacle damage - let player keep moving // The shared immunity system will handle the collision prevention @@ -62,7 +63,7 @@ namespace Minigames.DivingForPictures /// private void HandleImmunityEnded() { - Debug.Log($"[ObstacleCollision] Damage immunity ended"); + Logging.Debug($"[ObstacleCollision] Damage immunity ended"); // No special handling needed - shared immunity system handles collider re-enabling } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerBlinkBehavior.cs b/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerBlinkBehavior.cs index ca62c174..8f2a68f2 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerBlinkBehavior.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerBlinkBehavior.cs @@ -1,6 +1,7 @@ using UnityEngine; using System.Collections; using AppleHills.Core.Settings; +using Core; namespace Minigames.DivingForPictures { @@ -40,7 +41,7 @@ namespace Minigames.DivingForPictures targetSpriteRenderer = GetComponentInChildren(); if (targetSpriteRenderer != null) { - Debug.Log($"[PlayerBlinkBehavior] Found SpriteRenderer on child object: {targetSpriteRenderer.gameObject.name}"); + Logging.Debug($"[PlayerBlinkBehavior] Found SpriteRenderer on child object: {targetSpriteRenderer.gameObject.name}"); } } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerCollisionBehavior.cs b/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerCollisionBehavior.cs index 02e2793c..7e325f2c 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerCollisionBehavior.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerCollisionBehavior.cs @@ -3,6 +3,7 @@ using System; using System.Collections; using AppleHills.Core.Settings; using AppleHills.Utilities; +using Core; namespace Minigames.DivingForPictures { @@ -228,7 +229,7 @@ namespace Minigames.DivingForPictures { playerController.enabled = false; wasInputBlocked = true; - Debug.Log($"[{GetType().Name}] Player input blocked during immunity"); + Logging.Debug($"[{GetType().Name}] Player input blocked during immunity"); } } @@ -245,7 +246,7 @@ namespace Minigames.DivingForPictures // Update the controller's target position to current position to prevent snapping UpdateControllerTarget(); - Debug.Log($"[{GetType().Name}] Player input restored after immunity"); + Logging.Debug($"[{GetType().Name}] Player input restored after immunity"); } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerController.cs b/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerController.cs index 8cb2b7c7..c2072602 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerController.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Player/PlayerController.cs @@ -2,6 +2,7 @@ using AppleHills.Core.Settings; using Input; using AppleHillsCamera; +using Core; namespace Minigames.DivingForPictures { @@ -59,11 +60,11 @@ namespace Minigames.DivingForPictures edgeAnchor = FindObjectOfType(); if (edgeAnchor == null) { - Debug.LogWarning("[PlayerController] No EdgeAnchor found in scene. Origin Y position won't update with camera changes."); + Logging.Warning("[PlayerController] No EdgeAnchor found in scene. Origin Y position won't update with camera changes."); } else { - Debug.Log($"[PlayerController] Auto-connected to EdgeAnchor on {edgeAnchor.gameObject.name}"); + Logging.Debug($"[PlayerController] Auto-connected to EdgeAnchor on {edgeAnchor.gameObject.name}"); } } } @@ -101,7 +102,7 @@ namespace Minigames.DivingForPictures InputManager.Instance?.SetDefaultConsumer(this); _isInitialized = true; - Debug.Log("[PlayerController] Initialized"); + Logging.Debug("[PlayerController] Initialized"); } private void OnDestroy() @@ -120,7 +121,7 @@ namespace Minigames.DivingForPictures /// public void OnTap(Vector2 worldPosition) { - // Debug.Log($"[EndlessDescenderController] OnTap at {worldPosition}"); + // Logging.Debug($"[EndlessDescenderController] OnTap at {worldPosition}"); float targetX = Mathf.Clamp(worldPosition.x, _settings.ClampXMin, _settings.ClampXMax); // Calculate tap direction (+1 for right, -1 for left) @@ -141,7 +142,7 @@ namespace Minigames.DivingForPictures /// public void OnHoldStart(Vector2 worldPosition) { - // Debug.Log($"[EndlessDescenderController] OnHoldStart at {worldPosition}"); + // Logging.Debug($"[EndlessDescenderController] OnHoldStart at {worldPosition}"); _targetFingerX = Mathf.Clamp(worldPosition.x, _settings.ClampXMin, _settings.ClampXMax); _isTouchActive = true; } @@ -151,7 +152,7 @@ namespace Minigames.DivingForPictures /// public void OnHoldMove(Vector2 worldPosition) { - // Debug.Log($"[EndlessDescenderController] OnHoldMove at {worldPosition}"); + // Logging.Debug($"[EndlessDescenderController] OnHoldMove at {worldPosition}"); _targetFingerX = Mathf.Clamp(worldPosition.x, _settings.ClampXMin, _settings.ClampXMax); } @@ -160,7 +161,7 @@ namespace Minigames.DivingForPictures /// public void OnHoldEnd(Vector2 worldPosition) { - // Debug.Log($"[EndlessDescenderController] OnHoldEnd at {worldPosition}"); + // Logging.Debug($"[EndlessDescenderController] OnHoldEnd at {worldPosition}"); _isTouchActive = false; } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Player/RopeEndPhysicsFollower.cs b/Assets/Scripts/Minigames/DivingForPictures/Player/RopeEndPhysicsFollower.cs index a18babb5..d04adb0f 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Player/RopeEndPhysicsFollower.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Player/RopeEndPhysicsFollower.cs @@ -1,4 +1,5 @@ -using GogoGaga.OptimizedRopesAndCables; +using Core; +using GogoGaga.OptimizedRopesAndCables; using UnityEngine; public class RopeEndPhysicsFollower : MonoBehaviour @@ -46,7 +47,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour if (targetTransform != null) { target = targetTransform; - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Using assigned target transform: {target.name}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Using assigned target transform: {target.name}"); } else if (!string.IsNullOrEmpty(targetTag)) { @@ -54,7 +55,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour if (found) { target = found.transform; - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Found target by tag '{targetTag}': {target.name}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Found target by tag '{targetTag}': {target.name}"); } } @@ -71,14 +72,14 @@ public class RopeEndPhysicsFollower : MonoBehaviour if (canFall) { physicsVelocity = new Vector2(0, -initialFallImpulse); - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Initialized with target: {target.name}, initial Y velocity: {physicsVelocity.y}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Initialized with target: {target.name}, initial Y velocity: {physicsVelocity.y}"); } } else { offset = Vector2.zero; lastTargetPosition = transform.position; - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] No target found"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] No target found"); } initialized = true; @@ -124,7 +125,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour // Debug log to track vertical hanging behavior if (debugLog && Time.frameCount % 120 == 0) { - Debug.Log($"[RopeEndPhysicsFollower] Vertical hanging: target X={target.position.x}, my X={transform.position.x}, offset={xOffset}"); + Logging.Debug($"[RopeEndPhysicsFollower] Vertical hanging: target X={target.position.x}, my X={transform.position.x}, offset={xOffset}"); } } @@ -142,7 +143,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour if (debugLog && Time.frameCount % 60 == 0) { - Debug.Log($"[RopeEndPhysicsFollower] Exceeding max distance: {exceededDistance}, applying constraint"); + Logging.Debug($"[RopeEndPhysicsFollower] Exceeding max distance: {exceededDistance}, applying constraint"); } } @@ -152,7 +153,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour // Log physics state periodically for debugging if (debugLog && Time.frameCount % 60 == 0) { - Debug.Log($"[RopeEndPhysicsFollower] Y position: {transform.position.y}, Y velocity: {physicsVelocity.y}, Distance: {currentDistance}/{maxDistance}"); + Logging.Debug($"[RopeEndPhysicsFollower] Y position: {transform.position.y}, Y velocity: {physicsVelocity.y}, Distance: {currentDistance}/{maxDistance}"); } // Apply physics velocity to position @@ -227,13 +228,13 @@ public class RopeEndPhysicsFollower : MonoBehaviour if (attachedRope != null) { maxDistance = attachedRope.ropeLength; - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Found attached rope with length: {maxDistance}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Found attached rope with length: {maxDistance}"); } else { // Default fallback value if no rope is found maxDistance = 2f; - if (debugLog) Debug.Log("[RopeEndPhysicsFollower] No attached rope found, using default max distance"); + if (debugLog) Logging.Debug("[RopeEndPhysicsFollower] No attached rope found, using default max distance"); } } @@ -264,7 +265,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour if (canFall) { physicsVelocity = new Vector2(physicsVelocity.x, -initialFallImpulse); - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Reset Y velocity to {physicsVelocity.y} after target change to {target.name}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Reset Y velocity to {physicsVelocity.y} after target change to {target.name}"); } } } @@ -293,7 +294,7 @@ public class RopeEndPhysicsFollower : MonoBehaviour pos.y = target.position.y; transform.position = pos; - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Physics forcibly reset, new Y velocity: {physicsVelocity.y}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Physics forcibly reset, new Y velocity: {physicsVelocity.y}"); } } @@ -301,6 +302,6 @@ public class RopeEndPhysicsFollower : MonoBehaviour public void SetMaxDistance(float distance) { maxDistance = distance; - if (debugLog) Debug.Log($"[RopeEndPhysicsFollower] Max distance manually set to: {maxDistance}"); + if (debugLog) Logging.Debug($"[RopeEndPhysicsFollower] Max distance manually set to: {maxDistance}"); } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Player/TileBumpCollision.cs b/Assets/Scripts/Minigames/DivingForPictures/Player/TileBumpCollision.cs index 3cb5d32d..7e3b0bc4 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Player/TileBumpCollision.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Player/TileBumpCollision.cs @@ -1,6 +1,7 @@ using UnityEngine; using System.Collections; using AppleHills.Core.Settings; +using Core; namespace Minigames.DivingForPictures { @@ -19,7 +20,7 @@ namespace Minigames.DivingForPictures if (obstacle.gameObject.layer != _devSettings.TrenchTileLayer) { // If not on the trench tile layer, don't process the collision - Debug.Log($"[TileBumpCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.TrenchTileLayer})"); + Logging.Debug($"[TileBumpCollision] Ignored collision with object on layer {obstacle.gameObject.layer} (expected {_devSettings.TrenchTileLayer})"); return; } @@ -35,7 +36,7 @@ namespace Minigames.DivingForPictures break; } - Debug.Log($"[TileBumpCollision] Collision handled with {_devSettings.BumpMode} mode"); + Logging.Debug($"[TileBumpCollision] Collision handled with {_devSettings.BumpMode} mode"); } /// @@ -64,7 +65,7 @@ namespace Minigames.DivingForPictures StartBump(currentX, targetX, bumpDuration); - Debug.Log($"[TileBumpCollision] Starting impulse bump from X={currentX} to X={targetX} (force={_gameSettings.BumpForce})"); + Logging.Debug($"[TileBumpCollision] Starting impulse bump from X={currentX} to X={targetX} (force={_gameSettings.BumpForce})"); } /// @@ -82,7 +83,7 @@ namespace Minigames.DivingForPictures StartBump(currentX, targetX, bumpDuration); - Debug.Log($"[TileBumpCollision] Starting smooth move to center from X={currentX} (speed={_gameSettings.SmoothMoveSpeed}, duration={bumpDuration:F2}s)"); + Logging.Debug($"[TileBumpCollision] Starting smooth move to center from X={currentX} (speed={_gameSettings.SmoothMoveSpeed}, duration={bumpDuration:F2}s)"); } /// @@ -144,7 +145,7 @@ namespace Minigames.DivingForPictures _isBumping = false; _bumpCoroutine = null; - Debug.Log("[TileBumpCollision] Bump movement completed"); + Logging.Debug("[TileBumpCollision] Bump movement completed"); } } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTilePool.cs b/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTilePool.cs index 2876925e..444c8300 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTilePool.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTilePool.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Core; using UnityEngine; using Pooling; @@ -26,7 +27,7 @@ namespace Minigames.DivingForPictures } else { - Debug.LogWarning($"Attempted to return a GameObject without a Tile component: {tile.name}"); + Logging.Warning($"Attempted to return a GameObject without a Tile component: {tile.name}"); Destroy(tile); } } diff --git a/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTileSpawner.cs b/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTileSpawner.cs index 8bb14851..96a0c99f 100644 --- a/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTileSpawner.cs +++ b/Assets/Scripts/Minigames/DivingForPictures/Tiles/TrenchTileSpawner.cs @@ -7,6 +7,7 @@ using Pooling; using AppleHills.Core.Settings; using Utils; using AppleHills.Core.Interfaces; +using Core; namespace Minigames.DivingForPictures { @@ -158,7 +159,7 @@ namespace Minigames.DivingForPictures // Check if the prefab has a Tile component if (tilePrefabs[i].GetComponent() == null) { - Debug.LogWarning($"Prefab {tilePrefabs[i].name} does not have a Tile component. Adding one automatically."); + Logging.Warning($"Prefab {tilePrefabs[i].name} does not have a Tile component. Adding one automatically."); // Add the Tile component if it doesn't exist tilePrefabs[i].AddComponent(); } @@ -220,7 +221,7 @@ namespace Minigames.DivingForPictures _speedRampingCoroutine = null; } - Debug.Log("[TrenchTileSpawner] Paused"); + Logging.Debug("[TrenchTileSpawner] Paused"); } /// @@ -238,7 +239,7 @@ namespace Minigames.DivingForPictures StartTileSpawningCoroutine(); StartSpeedRampingCoroutine(); - Debug.Log("[TrenchTileSpawner] Resumed"); + Logging.Debug("[TrenchTileSpawner] Resumed"); } /// @@ -264,7 +265,7 @@ namespace Minigames.DivingForPictures StartTileSpawningCoroutine(); StartSpeedRampingCoroutine(); - Debug.Log("[TrenchTileSpawner] Initialized with normalized speed"); + Logging.Debug("[TrenchTileSpawner] Initialized with normalized speed"); } /// @@ -327,7 +328,7 @@ namespace Minigames.DivingForPictures { // Fallback in case no renderer is found _tileHeights[prefab] = DefaultTileHeight; - Debug.LogWarning($"No renderer found in prefab {prefab.name}. Using default height of {DefaultTileHeight}."); + Logging.Warning($"No renderer found in prefab {prefab.name}. Using default height of {DefaultTileHeight}."); } } } @@ -449,7 +450,7 @@ namespace Minigames.DivingForPictures // Calculate normalization factor based on screen height _screenNormalizationFactor = Screen.height / referenceHeight; - Debug.Log($"[TrenchTileSpawner] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})"); + Logging.Debug($"[TrenchTileSpawner] Screen normalization factor: {_screenNormalizationFactor} (Screen height: {Screen.height}, Reference: {referenceHeight})"); } /// @@ -466,7 +467,7 @@ namespace Minigames.DivingForPictures // Recalculate velocity immediately CalculateVelocity(); - Debug.Log($"[TrenchTileSpawner] Velocity factor updated to {_velocityFactor:F2}, moveSpeed: {_baseMoveSpeed:F2}"); + Logging.Debug($"[TrenchTileSpawner] Velocity factor updated to {_velocityFactor:F2}, moveSpeed: {_baseMoveSpeed:F2}"); } /// @@ -482,7 +483,7 @@ namespace Minigames.DivingForPictures // Reverse the active tiles array to maintain consistent indexing logic _activeTiles.Reverse(); - Debug.Log("[TrenchTileSpawner] Started surfacing - reversed array order"); + Logging.Debug("[TrenchTileSpawner] Started surfacing - reversed array order"); } /// @@ -509,7 +510,7 @@ namespace Minigames.DivingForPictures /// private IEnumerator MoveActiveTilesRoutine() { - Debug.Log($"[TrenchTileSpawner] Started movement coroutine with normalized speed: {_baseMoveSpeed:F3}"); + Logging.Debug($"[TrenchTileSpawner] Started movement coroutine with normalized speed: {_baseMoveSpeed:F3}"); while (enabled && gameObject.activeInHierarchy && !_isPaused) { @@ -550,7 +551,7 @@ namespace Minigames.DivingForPictures private IEnumerator TileDestructionRoutine() { const float checkInterval = 0.5f; // Check every half second - Debug.Log($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s"); + Logging.Debug($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s"); while (enabled && gameObject.activeInHierarchy && !_isPaused) { @@ -618,7 +619,7 @@ namespace Minigames.DivingForPictures private IEnumerator TileSpawningRoutine() { const float checkInterval = 0.2f; // Check every fifth of a second - Debug.Log($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s"); + Logging.Debug($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s"); while (enabled && gameObject.activeInHierarchy && !_isPaused && !_stopSpawning) { @@ -711,7 +712,7 @@ namespace Minigames.DivingForPictures private IEnumerator SpeedRampingRoutine() { const float checkInterval = 1.0f; // Check once per second - Debug.Log($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s"); + Logging.Debug($"[TrenchTileSpawner] Started speed ramping coroutine with interval: {checkInterval}s"); while (enabled && gameObject.activeInHierarchy && !_isPaused) { @@ -887,7 +888,7 @@ namespace Minigames.DivingForPictures _activeTiles.Add(tile); _tileLastUsed[prefabIndex] = _spawnCounter++; _currentDepth++; - Debug.Log($"[TrenchTileSpawner] Current Depth: {_currentDepth}"); + Logging.Debug($"[TrenchTileSpawner] Current Depth: {_currentDepth}"); onTileSpawned?.Invoke(tile); // --- FLOATING AREA STATE MANAGEMENT --- @@ -949,7 +950,7 @@ namespace Minigames.DivingForPictures } _activeTiles.Add(tile); _currentDepth++; - Debug.Log($"[TrenchTileSpawner] Current Depth: {_currentDepth}"); + Logging.Debug($"[TrenchTileSpawner] Current Depth: {_currentDepth}"); onTileSpawned?.Invoke(tile); // Optionally update floating area state if needed Tile spawnedTile = tile.GetComponent(); @@ -1035,7 +1036,7 @@ namespace Minigames.DivingForPictures { if (tile == null) { - Debug.LogWarning("Attempted to get height of null tile!"); + Logging.Warning("Attempted to get height of null tile!"); return DefaultTileHeight; } @@ -1171,7 +1172,7 @@ namespace Minigames.DivingForPictures private IEnumerator TileDestructionCoroutine() { const float checkInterval = 0.5f; // Check every half second as requested - Debug.Log($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s"); + Logging.Debug($"[TrenchTileSpawner] Started tile destruction coroutine with interval: {checkInterval}s"); while (enabled && gameObject.activeInHierarchy) { @@ -1248,7 +1249,7 @@ namespace Minigames.DivingForPictures private IEnumerator TileSpawningCoroutine() { const float checkInterval = 0.2f; // Check every half second as requested - Debug.Log($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s"); + Logging.Debug($"[TrenchTileSpawner] Started tile spawning coroutine with interval: {checkInterval}s"); while (enabled && gameObject.activeInHierarchy) { diff --git a/Assets/Scripts/Pooling/BaseObjectPool.cs b/Assets/Scripts/Pooling/BaseObjectPool.cs index 5ffea7c1..f5715b91 100644 --- a/Assets/Scripts/Pooling/BaseObjectPool.cs +++ b/Assets/Scripts/Pooling/BaseObjectPool.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Core; using UnityEngine; namespace Pooling @@ -35,7 +36,7 @@ namespace Pooling CreateNew(); } - Debug.Log($"[{GetType().Name}] Initialized with {initialPoolSize} objects"); + Logging.Debug($"[{GetType().Name}] Initialized with {initialPoolSize} objects"); } /// @@ -128,7 +129,7 @@ namespace Pooling /// public virtual void LogPoolStats() { - Debug.Log($"[{GetType().Name}] Pooled objects: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})"); + Logging.Debug($"[{GetType().Name}] Pooled objects: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})"); } #if UNITY_EDITOR diff --git a/Assets/Scripts/Pooling/MultiPrefabPool.cs b/Assets/Scripts/Pooling/MultiPrefabPool.cs index 75e2d0da..3a2f420d 100644 --- a/Assets/Scripts/Pooling/MultiPrefabPool.cs +++ b/Assets/Scripts/Pooling/MultiPrefabPool.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Core; using UnityEngine; namespace Pooling @@ -58,7 +59,7 @@ namespace Pooling } } - Debug.Log($"[{GetType().Name}] Initialized with {prefabs.Count} prefab types"); + Logging.Debug($"[{GetType().Name}] Initialized with {prefabs.Count} prefab types"); } /// @@ -115,7 +116,7 @@ namespace Pooling // Try to get a valid object from the pool, cleaning up any destroyed objects if (pooledObjects.ContainsKey(prefabIndex) && pooledObjects[prefabIndex].Count > 0) { - Debug.Log($"[{GetType().Name}] Found {pooledObjects[prefabIndex].Count} objects in pool for prefab index {prefabIndex}"); + Logging.Debug($"[{GetType().Name}] Found {pooledObjects[prefabIndex].Count} objects in pool for prefab index {prefabIndex}"); // Keep trying until we find a valid object or the pool is empty while (pooledObjects[prefabIndex].Count > 0) @@ -126,20 +127,20 @@ namespace Pooling // Check if the object is still valid (not destroyed) if (obj != null && obj.gameObject != null) { - Debug.Log($"[{GetType().Name}] Retrieved valid object {obj.name} from pool, current active state: {obj.gameObject.activeInHierarchy}"); + Logging.Debug($"[{GetType().Name}] Retrieved valid object {obj.name} from pool, current active state: {obj.gameObject.activeInHierarchy}"); break; // Found a valid object } else { // Object was destroyed, continue looking - Debug.LogWarning($"[{GetType().Name}] Found destroyed object in pool, removing it"); + Logging.Warning($"[{GetType().Name}] Found destroyed object in pool, removing it"); obj = null; } } } else { - Debug.Log($"[{GetType().Name}] No objects in pool for prefab index {prefabIndex}, creating new one"); + Logging.Debug($"[{GetType().Name}] No objects in pool for prefab index {prefabIndex}, creating new one"); } // If we couldn't find a valid object in the pool, create a new one @@ -147,7 +148,7 @@ namespace Pooling { T prefab = prefabs[prefabIndex]; obj = Instantiate(prefab, transform); - Debug.Log($"[{GetType().Name}] Created new object {obj.name} from prefab, active state: {obj.gameObject.activeInHierarchy}"); + Logging.Debug($"[{GetType().Name}] Created new object {obj.name} from prefab, active state: {obj.gameObject.activeInHierarchy}"); } // Ensure the object is valid before proceeding @@ -161,22 +162,22 @@ namespace Pooling // This prevents off-screen checks from triggering during spawn process Vector3 originalPosition = obj.transform.position; obj.transform.position = new Vector3(0f, -1000f, 0f); - Debug.Log($"[{GetType().Name}] Moved object {obj.name} from {originalPosition} to safe position before activation"); + Logging.Debug($"[{GetType().Name}] Moved object {obj.name} from {originalPosition} to safe position before activation"); - Debug.Log($"[{GetType().Name}] About to activate object {obj.name}, current state: {obj.gameObject.activeInHierarchy}"); + Logging.Debug($"[{GetType().Name}] About to activate object {obj.name}, current state: {obj.gameObject.activeInHierarchy}"); obj.gameObject.SetActive(true); - Debug.Log($"[{GetType().Name}] After SetActive(true), object {obj.name} state: {obj.gameObject.activeInHierarchy}"); + Logging.Debug($"[{GetType().Name}] After SetActive(true), object {obj.name} state: {obj.gameObject.activeInHierarchy}"); // Call OnSpawn for IPoolable components IPoolable poolable = obj.GetComponent(); if (poolable != null) { - Debug.Log($"[{GetType().Name}] Calling OnSpawn for object {obj.name}"); + Logging.Debug($"[{GetType().Name}] Calling OnSpawn for object {obj.name}"); poolable.OnSpawn(); - Debug.Log($"[{GetType().Name}] After OnSpawn, object {obj.name} state: {obj.gameObject.activeInHierarchy}"); + Logging.Debug($"[{GetType().Name}] After OnSpawn, object {obj.name} state: {obj.gameObject.activeInHierarchy}"); } - Debug.Log($"[{GetType().Name}] Returning object {obj.name} with final state: {obj.gameObject.activeInHierarchy}"); + Logging.Debug($"[{GetType().Name}] Returning object {obj.name} with final state: {obj.gameObject.activeInHierarchy}"); return obj; } @@ -297,7 +298,7 @@ namespace Pooling /// public virtual void LogPoolStats() { - Debug.Log($"[{GetType().Name}] Total pooled objects: {totalPooledCount}/{totalMaxPoolSize}"); + Logging.Debug($"[{GetType().Name}] Total pooled objects: {totalPooledCount}/{totalMaxPoolSize}"); string prefabDetails = ""; int index = 0; @@ -318,7 +319,7 @@ namespace Pooling } } - Debug.Log($"[{GetType().Name}] Pool details:{prefabDetails}"); + Logging.Debug($"[{GetType().Name}] Pool details:{prefabDetails}"); } #if UNITY_EDITOR diff --git a/Assets/Scripts/PuzzleS/ObjectiveStepBehaviour.cs b/Assets/Scripts/PuzzleS/ObjectiveStepBehaviour.cs index e0a7f3ea..655c27e7 100644 --- a/Assets/Scripts/PuzzleS/ObjectiveStepBehaviour.cs +++ b/Assets/Scripts/PuzzleS/ObjectiveStepBehaviour.cs @@ -3,6 +3,7 @@ using Interactions; using UnityEngine; using System; using AppleHills.Core.Settings; +using Core; using UnityEngine.Serialization; namespace PuzzleS @@ -102,7 +103,7 @@ namespace PuzzleS } // Default fallback behavior - Debug.Log($"[Puzzles] Prompt shown for {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Prompt shown for {stepData?.stepId} on {gameObject.name}"); } /// @@ -118,7 +119,7 @@ namespace PuzzleS } // Default fallback behavior - Debug.Log($"[Puzzles] Prompt hidden for {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Prompt hidden for {stepData?.stepId} on {gameObject.name}"); } /// @@ -137,7 +138,7 @@ namespace PuzzleS } // Default fallback behavior - Debug.Log($"[Puzzles] Player entered far range of {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Player entered far range of {stepData?.stepId} on {gameObject.name}"); } /// @@ -156,7 +157,7 @@ namespace PuzzleS } // Default fallback behavior - Debug.Log($"[Puzzles] Player entered close range of {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Player entered close range of {stepData?.stepId} on {gameObject.name}"); } /// @@ -175,7 +176,7 @@ namespace PuzzleS } // Default fallback behavior - Debug.Log($"[Puzzles] Player exited close range of {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Player exited close range of {stepData?.stepId} on {gameObject.name}"); } /// @@ -194,7 +195,7 @@ namespace PuzzleS } // Default fallback behavior - Debug.Log($"[Puzzles] Player exited far range of {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Player exited far range of {stepData?.stepId} on {gameObject.name}"); } /// @@ -203,7 +204,7 @@ namespace PuzzleS public void UnlockStep() { _isUnlocked = true; - Debug.Log($"[Puzzles] Step unlocked: {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Step unlocked: {stepData?.stepId} on {gameObject.name}"); // Show indicator if enabled in settings if (puzzleIndicator != null) @@ -219,7 +220,7 @@ namespace PuzzleS if (_indicator == null) { - Debug.LogWarning($"[Puzzles] Indicator prefab for {stepData?.stepId} does not implement IPuzzlePrompt"); + Logging.Warning($"[Puzzles] Indicator prefab for {stepData?.stepId} does not implement IPuzzlePrompt"); } else { @@ -262,7 +263,7 @@ namespace PuzzleS public void LockStep() { _isUnlocked = false; - Debug.Log($"[Puzzles] Step locked: {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Step locked: {stepData?.stepId} on {gameObject.name}"); // Hide indicator if (_indicator != null) @@ -296,7 +297,7 @@ namespace PuzzleS if (!_isUnlocked) return; if (success) { - Debug.Log($"[Puzzles] Step interacted: {stepData?.stepId} on {gameObject.name}"); + Logging.Debug($"[Puzzles] Step interacted: {stepData?.stepId} on {gameObject.name}"); PuzzleManager.Instance?.MarkPuzzleStepCompleted(stepData); } } diff --git a/Assets/Scripts/PuzzleS/PuzzleManager.cs b/Assets/Scripts/PuzzleS/PuzzleManager.cs index 433ca719..0b3542c8 100644 --- a/Assets/Scripts/PuzzleS/PuzzleManager.cs +++ b/Assets/Scripts/PuzzleS/PuzzleManager.cs @@ -4,7 +4,8 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.SceneManagement; -using AppleHills.Core.Settings; // Added for IInteractionSettings +using AppleHills.Core.Settings; +using Core; // Added for IInteractionSettings namespace PuzzleS { @@ -86,7 +87,7 @@ namespace PuzzleS { SceneManager.sceneLoaded -= OnSceneLoaded; - Debug.Log("[MDPI] OnSceneLoaded"); + Logging.Debug("[MDPI] OnSceneLoaded"); _runtimeDependencies.Clear(); BuildRuntimeDependencies(); UnlockInitialSteps(); @@ -173,7 +174,7 @@ namespace PuzzleS _unlockedSteps.Clear(); BuildRuntimeDependencies(); UnlockInitialSteps(); - Debug.Log($"[Puzzles] Registered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}"); + Logging.Debug($"[Puzzles] Registered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}"); } } @@ -185,7 +186,7 @@ namespace PuzzleS { if (behaviour?.stepData == null) return; _stepBehaviours.Remove(behaviour.stepData); - Debug.Log($"[Puzzles] Unregistered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}"); + Logging.Debug($"[Puzzles] Unregistered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}"); } /// @@ -198,10 +199,10 @@ namespace PuzzleS { foreach (var dep in _runtimeDependencies[step]) { - Debug.Log($"[Puzzles] Step {step.stepId} depends on {dep.stepId}"); + Logging.Debug($"[Puzzles] Step {step.stepId} depends on {dep.stepId}"); } } - Debug.Log($"[Puzzles] Runtime dependencies built. Total steps: {_stepBehaviours.Count}"); + Logging.Debug($"[Puzzles] Runtime dependencies built. Total steps: {_stepBehaviours.Count}"); } /// @@ -213,7 +214,7 @@ namespace PuzzleS var initialSteps = PuzzleGraphUtility.FindInitialSteps(_runtimeDependencies); foreach (var step in initialSteps) { - Debug.Log($"[Puzzles] Initial step unlocked: {step.stepId}"); + Logging.Debug($"[Puzzles] Initial step unlocked: {step.stepId}"); UnlockStep(step); } @@ -229,7 +230,7 @@ namespace PuzzleS // Check if all dependencies have been completed if (AreRuntimeDependenciesMet(step)) { - Debug.Log($"[Puzzles] Chain step unlocked: {step.stepId}"); + Logging.Debug($"[Puzzles] Chain step unlocked: {step.stepId}"); UnlockStep(step); madeProgress = true; } @@ -245,7 +246,7 @@ namespace PuzzleS { if (_completedSteps.Contains(step)) return; _completedSteps.Add(step); - Debug.Log($"[Puzzles] Step completed: {step.stepId}"); + Logging.Debug($"[Puzzles] Step completed: {step.stepId}"); // Broadcast completion OnStepCompleted?.Invoke(step); @@ -254,12 +255,12 @@ namespace PuzzleS { if (AreRuntimeDependenciesMet(unlock)) { - Debug.Log($"[Puzzles] Unlocking step {unlock.stepId} after completing {step.stepId}"); + Logging.Debug($"[Puzzles] Unlocking step {unlock.stepId} after completing {step.stepId}"); UnlockStep(unlock); } else { - Debug.Log($"[Puzzles] Step {unlock.stepId} not unlocked yet, waiting for other dependencies"); + Logging.Debug($"[Puzzles] Step {unlock.stepId} not unlocked yet, waiting for other dependencies"); } } CheckPuzzleCompletion(); @@ -292,7 +293,7 @@ namespace PuzzleS { behaviour.UnlockStep(); } - Debug.Log($"[Puzzles] Step unlocked: {step.stepId}"); + Logging.Debug($"[Puzzles] Step unlocked: {step.stepId}"); // Broadcast unlock OnStepUnlocked?.Invoke(step); @@ -305,7 +306,7 @@ namespace PuzzleS { if (_completedSteps.Count == _stepBehaviours.Count) { - Debug.Log("[Puzzles] Puzzle complete! All steps finished."); + Logging.Debug("[Puzzles] Puzzle complete! All steps finished."); // TODO: Fire puzzle complete event or trigger outcome logic } } diff --git a/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs b/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs index 069cd840..02c0ff5d 100644 --- a/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs +++ b/Assets/Scripts/UI/CardSystem/AlbumViewPage.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using Pixelplacement; using UnityEngine; @@ -251,7 +252,7 @@ namespace AppleHills.UI.CardSystem // Animate card to center of slot using Pixelplacement.Tween Tween.LocalPosition(cardUI.transform, Vector3.zero, 0.25f, 0f, Tween.EaseOutBack); - Debug.Log($"[AlbumViewPage] Placed card '{cardUI.GetCardData().Name}' in album slot"); + Logging.Debug($"[AlbumViewPage] Placed card '{cardUI.GetCardData().Name}' in album slot"); } /// diff --git a/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs b/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs index 56bd7668..ffcfe265 100644 --- a/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs +++ b/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using Pixelplacement; using UnityEngine; @@ -137,7 +138,7 @@ namespace AppleHills.UI.CardSystem } else { - Debug.LogWarning("[BoosterOpeningPage] No cards were obtained from the booster pack."); + Logging.Warning("[BoosterOpeningPage] No cards were obtained from the booster pack."); UIPageController.Instance.PopPage(); } } diff --git a/Assets/Scripts/UI/CardSystem/CardAlbumUI.cs b/Assets/Scripts/UI/CardSystem/CardAlbumUI.cs index 79d60628..01a82faa 100644 --- a/Assets/Scripts/UI/CardSystem/CardAlbumUI.cs +++ b/Assets/Scripts/UI/CardSystem/CardAlbumUI.cs @@ -1,5 +1,6 @@ using System; using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using UnityEngine; using UnityEngine.UI; @@ -168,7 +169,7 @@ namespace AppleHills.UI.CardSystem } else { - Debug.Log("[CardAlbumUI] No booster packs available"); + Logging.Debug("[CardAlbumUI] No booster packs available"); // TODO: Show "no boosters available" message } } diff --git a/Assets/Scripts/UI/CardSystem/CardMenuPage.cs b/Assets/Scripts/UI/CardSystem/CardMenuPage.cs index 85a7683f..eee13f73 100644 --- a/Assets/Scripts/UI/CardSystem/CardMenuPage.cs +++ b/Assets/Scripts/UI/CardSystem/CardMenuPage.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using AppleHills.Data.CardSystem; +using Core; using Data.CardSystem; using Pixelplacement; using UnityEngine; @@ -136,7 +137,7 @@ namespace AppleHills.UI.CardSystem /// private void OnChangeClothesClicked() { - Debug.Log("[CardMenuPage] Change Clothes feature coming soon!"); + Logging.Debug("[CardMenuPage] Change Clothes feature coming soon!"); // No implementation yet - "Coming soon" feature } diff --git a/Assets/Scripts/UI/CardSystem/CardUIElement.cs b/Assets/Scripts/UI/CardSystem/CardUIElement.cs index e1763543..8884e810 100644 --- a/Assets/Scripts/UI/CardSystem/CardUIElement.cs +++ b/Assets/Scripts/UI/CardSystem/CardUIElement.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using AppleHills.Data.CardSystem; +using Core; using UnityEngine; using TMPro; using UnityEngine.UI; @@ -37,7 +38,7 @@ namespace AppleHills.UI.CardSystem /// public void SetupCard(CardData cardData) { - Debug.Log($"[CardUIElement] Setting up card with data: {cardData}"); + Logging.Debug($"[CardUIElement] Setting up card with data: {cardData}"); this.cardData = cardData; @@ -199,7 +200,7 @@ namespace AppleHills.UI.CardSystem public void OnShowAnimation() { // Stub for card reveal animation - Debug.Log($"[CardUIElement] Showing card: {cardData?.Name}"); + Logging.Debug($"[CardUIElement] Showing card: {cardData?.Name}"); // Could add animation code or call Animation Trigger here } @@ -209,7 +210,7 @@ namespace AppleHills.UI.CardSystem public void OnMoveToBackpackAnimation() { // Stub for animation when card moves to backpack - Debug.Log($"[CardUIElement] Moving card to backpack: {cardData?.Name}"); + Logging.Debug($"[CardUIElement] Moving card to backpack: {cardData?.Name}"); // Could add animation code or call Animation Trigger here } @@ -221,14 +222,14 @@ namespace AppleHills.UI.CardSystem { if (cardDefinition == null) { - Debug.LogWarning("[CardUIElement] Cannot create card data: No card definition assigned"); + Logging.Warning("[CardUIElement] Cannot create card data: No card definition assigned"); return; } cardData = cardDefinition.CreateCardData(); UpdateCardVisuals(); - Debug.Log($"[CardUIElement] Created card from definition: {cardData.Name}"); + Logging.Debug($"[CardUIElement] Created card from definition: {cardData.Name}"); } #endif } diff --git a/Assets/Scripts/UI/CardSystem/UIPageController.cs b/Assets/Scripts/UI/CardSystem/UIPageController.cs index dcf23908..0d6c96ff 100644 --- a/Assets/Scripts/UI/CardSystem/UIPageController.cs +++ b/Assets/Scripts/UI/CardSystem/UIPageController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Core; using UnityEngine; namespace AppleHills.UI.CardSystem @@ -49,7 +50,7 @@ namespace AppleHills.UI.CardSystem page.TransitionIn(); OnPageChanged?.Invoke(page); - Debug.Log($"[UIPageController] Pushed page: {page.PageName}"); + Logging.Debug($"[UIPageController] Pushed page: {page.PageName}"); } /// @@ -69,12 +70,12 @@ namespace AppleHills.UI.CardSystem UIPage previousPage = _pageStack.Peek(); previousPage.TransitionIn(); OnPageChanged?.Invoke(previousPage); - Debug.Log($"[UIPageController] Popped to previous page: {previousPage.PageName}"); + Logging.Debug($"[UIPageController] Popped to previous page: {previousPage.PageName}"); } else { OnPageChanged?.Invoke(null); - Debug.Log("[UIPageController] Popped last page, no pages left in stack"); + Logging.Debug("[UIPageController] Popped last page, no pages left in stack"); } } @@ -92,7 +93,7 @@ namespace AppleHills.UI.CardSystem // Clear stack _pageStack.Clear(); OnPageChanged?.Invoke(null); - Debug.Log("[UIPageController] Cleared page stack"); + Logging.Debug("[UIPageController] Cleared page stack"); } /// diff --git a/Assets/Scripts/UI/LoadingScreenController.cs b/Assets/Scripts/UI/LoadingScreenController.cs index 0d40e036..e902b7f7 100644 --- a/Assets/Scripts/UI/LoadingScreenController.cs +++ b/Assets/Scripts/UI/LoadingScreenController.cs @@ -146,7 +146,7 @@ namespace UI float displayProgress = Mathf.Min(steadyProgress, actualProgress); // Log the progress values for debugging - Debug.Log($"[LoadingScreen] Progress - Default: {steadyProgress:F2}, Actual: {actualProgress:F2}, Display: {displayProgress:F2}"); + Logging.Debug($"[LoadingScreen] Progress - Default: {steadyProgress:F2}, Actual: {actualProgress:F2}, Display: {displayProgress:F2}"); // Directly set the progress bar fill amount without smoothing if (progressBarImage != null) @@ -159,7 +159,7 @@ namespace UI if (steadyProgress >= 1.0f && displayProgress >= 1.0f) { _animationComplete = true; - Debug.Log("[LoadingScreen] Animation complete"); + Logging.Debug("[LoadingScreen] Animation complete"); break; } @@ -171,7 +171,7 @@ namespace UI if (progressBarImage != null) { progressBarImage.fillAmount = 1.0f; - Debug.Log("[LoadingScreen] Final progress set to 1.0"); + Logging.Debug("[LoadingScreen] Final progress set to 1.0"); } // Hide the screen if loading is also complete @@ -180,7 +180,7 @@ namespace UI if (loadingScreenContainer != null) { loadingScreenContainer.SetActive(false); - Debug.Log("[LoadingScreen] Animation AND loading complete, hiding screen"); + Logging.Debug("[LoadingScreen] Animation AND loading complete, hiding screen"); // Invoke the callback when fully hidden _onLoadingScreenFullyHidden?.Invoke(); @@ -196,7 +196,7 @@ namespace UI /// public void HideLoadingScreen() { - Debug.Log("[LoadingScreen] Loading complete, marking loading as finished"); + Logging.Debug("[LoadingScreen] Loading complete, marking loading as finished"); // Mark that loading is complete _loadingComplete = true; @@ -207,7 +207,7 @@ namespace UI if (loadingScreenContainer != null) { loadingScreenContainer.SetActive(false); - Debug.Log("[LoadingScreen] Animation already complete, hiding screen immediately"); + Logging.Debug("[LoadingScreen] Animation already complete, hiding screen immediately"); // Invoke the callback when fully hidden _onLoadingScreenFullyHidden?.Invoke(); @@ -216,7 +216,7 @@ namespace UI } else { - Debug.Log("[LoadingScreen] Animation still in progress, waiting for it to complete"); + Logging.Debug("[LoadingScreen] Animation still in progress, waiting for it to complete"); // The coroutine will handle hiding when animation completes } } diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index 6aca0c16..93d07f90 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -8,7 +8,7 @@ public class MainMenu : MonoBehaviour public async void StartGame() { // Replace with the actual scene name as set in Build Settings - var progress = new Progress(p => Debug.Log($"Loading progress: {p * 100:F0}%")); + var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); await SceneManagerService.Instance.SwitchSceneAsync("AppleHillsOverworld", progress); } diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index c6c4532e..54933f19 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -86,7 +86,7 @@ namespace UI if(!isMainMenu) HidePauseMenu(false); // Ensure menu is hidden when switching to a game level - Debug.Log($"[PauseMenu] Setting pause menu active: {!isMainMenu} for scene: {levelName}"); + Logging.Debug($"[PauseMenu] Setting pause menu active: {!isMainMenu} for scene: {levelName}"); } /// @@ -105,7 +105,7 @@ namespace UI InputManager.Instance.SetInputMode(InputMode.UI); OnGamePaused?.Invoke(); - Debug.Log("[PauseMenu] Game Paused"); + Logging.Debug("[PauseMenu] Game Paused"); } /// @@ -124,7 +124,7 @@ namespace UI InputManager.Instance.SetInputMode(InputMode.GameAndUI); OnGameResumed?.Invoke(); - Debug.Log("[PauseMenu] Game Resumed"); + Logging.Debug("[PauseMenu] Game Resumed"); } /// @@ -141,7 +141,7 @@ namespace UI public async void ExitToMainMenu() { // Replace with the actual scene name as set in Build Settings - var progress = new Progress(p => Debug.Log($"Loading progress: {p * 100:F0}%")); + var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); await SceneManagerService.Instance.SwitchSceneAsync("MainMenu", progress); } @@ -156,6 +156,12 @@ namespace UI Application.Quit(); #endif } + + public async void ReloadLevel() + { + var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); + await SceneManagerService.Instance.ReloadCurrentScene(progress); + } /// /// Loads a level based on the selection from a dropdown menu. @@ -168,7 +174,7 @@ namespace UI HidePauseMenu(); // Replace with the actual scene name as set in Build Settings - var progress = new Progress(p => Debug.Log($"Loading progress: {p * 100:F0}%")); + var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); switch (levelSelection) { case 0: diff --git a/Assets/Scripts/Utils/AppleHillsUtils.cs b/Assets/Scripts/Utils/AppleHillsUtils.cs index e2dd6faf..62df8b17 100644 --- a/Assets/Scripts/Utils/AppleHillsUtils.cs +++ b/Assets/Scripts/Utils/AppleHillsUtils.cs @@ -1,5 +1,6 @@ using UnityEngine; using AppleHills.Core.Settings; +using Core; namespace Utils { @@ -42,7 +43,7 @@ namespace Utils var settings = GameManager.GetSettingsObject(); if (settings == null) { - Debug.LogWarning("[AppleHillsUtils] Could not get settings, using default reference height"); + Logging.Warning("[AppleHillsUtils] Could not get settings, using default reference height"); return CalculateNormalizedMovementSpeed(normalizedSpeed, 1080f); } diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 6a75120f..cf1d829f 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,9 +5,6 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: - - enabled: 0 - path: Assets/Scenes/SampleScene.unity - guid: 8c9cfa26abfee488c85f1582747f6a02 - enabled: 1 path: Assets/Scenes/MainMenu.unity guid: b93f2f3b39a62684c8474ba79c8f698d diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 59d20491..5f084eba 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -820,7 +820,8 @@ PlayerSettings: webGLCloseOnQuit: 0 webWasm2023: 0 webEnableSubmoduleStrippingCompatibility: 0 - scriptingDefineSymbols: {} + scriptingDefineSymbols: + Android: ENABLE_LOG additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: