Compare commits

..

2 Commits

Author SHA1 Message Date
Michal Pikulski
6f515e954d Fix hud issues and have rainbow play correctly 2025-11-09 22:40:58 +01:00
Michal Pikulski
e9855faede Move app switcher to hud 2025-11-09 21:52:47 +01:00
52 changed files with 10381 additions and 11455 deletions

View File

@@ -248,9 +248,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2bd397a60643eed45b586961ae6e3453, type: 3} m_Script: {fileID: 11500000, guid: 2bd397a60643eed45b586961ae6e3453, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: AppleHillsScripts::PulverAudioController m_EditorClassIdentifier: AppleHillsScripts::PulverAudioController
audioSource: {fileID: 887004370483616855}
combineAudio: {fileID: 8300000, guid: 768a16f348fe1d94c9cc267dc7ecf3b5, type: 3} combineAudio: {fileID: 8300000, guid: 768a16f348fe1d94c9cc267dc7ecf3b5, type: 3}
itemManager: {fileID: 0}
--- !u!82 &4467608046243604209 --- !u!82 &4467608046243604209
AudioSource: AudioSource:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -1185,7 +1185,6 @@ MonoBehaviour:
CinematicBackground: {fileID: 1256355336041814197} CinematicBackground: {fileID: 1256355336041814197}
eagleEye: {fileID: 8093509920149135307} eagleEye: {fileID: 8093509920149135307}
ramaSjangButton: {fileID: 4599222264323240281} ramaSjangButton: {fileID: 4599222264323240281}
scrabBookButton: {fileID: 2880351836456325619}
cinematicSprites: {fileID: 0} cinematicSprites: {fileID: 0}
cinematicBackgroundSprites: {fileID: 0} cinematicBackgroundSprites: {fileID: 0}
currentCinematicPlayer: {fileID: 0} currentCinematicPlayer: {fileID: 0}

View File

@@ -614,7 +614,6 @@ GameObject:
- component: {fileID: 768265498311662326} - component: {fileID: 768265498311662326}
- component: {fileID: 6338084184716153992} - component: {fileID: 6338084184716153992}
- component: {fileID: 253472492358066383} - component: {fileID: 253472492358066383}
- component: {fileID: 7628818949793551399}
m_Layer: 10 m_Layer: 10
m_Name: FakeChoco m_Name: FakeChoco
m_TagString: Untagged m_TagString: Untagged
@@ -634,8 +633,7 @@ Transform:
m_LocalPosition: {x: -6.784, y: -2.901, z: 0} m_LocalPosition: {x: -6.784, y: -2.901, z: 0}
m_LocalScale: {x: 0.7, y: 0.7, z: 0.7} m_LocalScale: {x: 0.7, y: 0.7, z: 0.7}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children: []
- {fileID: 2205893234949555645}
m_Father: {fileID: 1509867968154593713} m_Father: {fileID: 1509867968154593713}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6338084184716153992 --- !u!212 &6338084184716153992
@@ -742,45 +740,6 @@ BoxCollider2D:
m_AutoTiling: 0 m_AutoTiling: 0
m_Size: {x: 6, y: 6} m_Size: {x: 6, y: 6}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!114 &7628818949793551399
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2391935521422290070}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 833a4ccef651449e973e623d9107bef5, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Interactions.OneClickInteraction
isOneTime: 0
cooldown: -1
characterToInteract: 2
interactionStarted:
m_PersistentCalls:
m_Calls: []
interactionInterrupted:
m_PersistentCalls:
m_Calls: []
characterArrived:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 5762733430166618195}
m_TargetAssemblyTypeName: PicnicBehaviour, AppleHillsScripts
m_MethodName: triedToStealChocolate
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
interactionComplete:
m_PersistentCalls:
m_Calls: []
--- !u!1 &2728537141134591410 --- !u!1 &2728537141134591410
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1363,104 +1322,6 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 5383276844808284485, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} m_CorrespondingSourceObject: {fileID: 5383276844808284485, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3}
m_PrefabInstance: {fileID: 3750141998400252915} m_PrefabInstance: {fileID: 3750141998400252915}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &7365721869475958115
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 768265498311662326}
m_Modifications:
- target: {fileID: 2991221189157356317, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalScale.x
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 2991221189157356317, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalScale.y
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 2991221189157356317, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalScale.z
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 8506461915049351794, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_Name
value: HighlightEffect
objectReference: {fileID: 0}
- target: {fileID: 8506461915049351794, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalScale.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalScale.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalScale.z
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8998003315986923927, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
propertyPath: m_SortingOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
--- !u!4 &2205893234949555645 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8693254833721559262, guid: f21581740b83b624cac5e6a8fa4d0f47, type: 3}
m_PrefabInstance: {fileID: 7365721869475958115}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7995402114015427944 --- !u!1001 &7995402114015427944
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1501,34 +1362,6 @@ PrefabInstance:
propertyPath: m_SortingOrder propertyPath: m_SortingOrder
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 5762733430166618195}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: destroyFakeChocolate
objectReference: {fileID: 0}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: PicnicBehaviour, AppleHillsScripts
objectReference: {fileID: 0}
- target: {fileID: 2846246689251721816, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: interactionComplete.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 3984039030829909690, guid: b3fc964bec385174f85a143f2fcff121, type: 3} - target: {fileID: 3984039030829909690, guid: b3fc964bec385174f85a143f2fcff121, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 0.7 value: 0.7

File diff suppressed because it is too large Load Diff

View File

@@ -285,8 +285,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1} m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 125} m_AnchoredPosition: {x: 0, y: 173}
m_SizeDelta: {x: 600, y: 120} m_SizeDelta: {x: 600, y: 150}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!222 &5545241165728741220 --- !u!222 &5545241165728741220
CanvasRenderer: CanvasRenderer:
@@ -343,8 +343,8 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 125 m_fontSize: 150
m_fontSizeBase: 125 m_fontSizeBase: 150
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 0 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
@@ -1053,10 +1053,6 @@ PrefabInstance:
propertyPath: m_SizeDelta.x propertyPath: m_SizeDelta.x
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4925415087786595420, guid: 1d8cc8d9238eec34b8e600e7050e2979, type: 3}
propertyPath: m_fontSize
value: 54.45
objectReference: {fileID: 0}
- target: {fileID: 5378230129755544441, guid: 1d8cc8d9238eec34b8e600e7050e2979, type: 3} - target: {fileID: 5378230129755544441, guid: 1d8cc8d9238eec34b8e600e7050e2979, type: 3}
propertyPath: m_AnchorMax.x propertyPath: m_AnchorMax.x
value: 0 value: 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -453761,10 +453761,6 @@ PrefabInstance:
propertyPath: m_PlayOnAwake propertyPath: m_PlayOnAwake
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8545106365577783398, guid: ead4e790fa3a1924ebd1586c93cd5479, type: 3}
propertyPath: isOneTime
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []

File diff suppressed because it is too large Load Diff

View File

@@ -86,7 +86,7 @@ namespace Cinematics
// If still null, try to add the component // If still null, try to add the component
if (playableDirector == null) if (playableDirector == null)
{ {
Logging.Debug("[CinematicsManager] Could not find Playable Director on the PlayerHudManager"); Debug.Log("[CinematicsManager] Could not find Playable Director on the PlayerHudManager");
} }
} }
@@ -99,7 +99,7 @@ namespace Cinematics
// If still null, return error // If still null, return error
if (_cinematicSprites == null) if (_cinematicSprites == null)
{ {
Logging.Warning("[CinematicsManager] No Image found for cinematics display. Cinematics may not display correctly."); Debug.LogWarning("[CinematicsManager] No Image found for cinematics display. Cinematics may not display correctly.");
} }
} }

View File

@@ -27,7 +27,7 @@ namespace Core.Lifecycle
{ {
if (_instance != null) if (_instance != null)
{ {
Logging.Warning("[LifecycleManager] Instance already exists"); Debug.LogWarning("[LifecycleManager] Instance already exists");
return; return;
} }
@@ -35,7 +35,7 @@ namespace Core.Lifecycle
_instance = go.AddComponent<LifecycleManager>(); _instance = go.AddComponent<LifecycleManager>();
DontDestroyOnLoad(go); DontDestroyOnLoad(go);
Logging.Debug("[LifecycleManager] Instance created"); Debug.Log("[LifecycleManager] Instance created");
} }
#endregion #endregion
@@ -85,7 +85,7 @@ namespace Core.Lifecycle
} }
else if (_instance != this) else if (_instance != this)
{ {
Logging.Warning("[LifecycleManager] Duplicate instance detected. Destroying."); Debug.LogWarning("[LifecycleManager] Duplicate instance detected. Destroying.");
Destroy(gameObject); Destroy(gameObject);
} }
} }
@@ -111,7 +111,7 @@ namespace Core.Lifecycle
{ {
if (component == null) if (component == null)
{ {
Logging.Warning("[LifecycleManager] Attempted to register null component"); Debug.LogWarning("[LifecycleManager] Attempted to register null component");
return; return;
} }
@@ -469,34 +469,6 @@ namespace Core.Lifecycle
LogDebug($"Restored scene data to {restoredCount} components"); LogDebug($"Restored scene data to {restoredCount} components");
} }
/// <summary>
/// Broadcasts scene restore completed event to all registered components.
/// Called AFTER all OnSceneRestoreRequested calls complete.
/// </summary>
public void BroadcastSceneRestoreCompleted()
{
LogDebug("Broadcasting SceneRestoreCompleted");
// Create a copy to avoid collection modification during iteration
var componentsCopy = new List<ManagedBehaviour>(managedAwakeList);
foreach (var component in componentsCopy)
{
if (component == null) continue;
try
{
component.InvokeSceneRestoreCompleted();
}
catch (Exception ex)
{
Debug.LogError($"[LifecycleManager] Exception during scene restore completed for {component.SaveId}: {ex}");
}
}
LogDebug("SceneRestoreCompleted broadcast complete");
}
/// <summary> /// <summary>
/// Broadcasts global restore request to all registered components that opt-in. /// Broadcasts global restore request to all registered components that opt-in.
/// Distributes serialized data to matching components by SaveId. /// Distributes serialized data to matching components by SaveId.
@@ -655,7 +627,7 @@ namespace Core.Lifecycle
{ {
if (enableDebugLogging) if (enableDebugLogging)
{ {
Logging.Debug($"[LifecycleManager] {message}"); Debug.Log($"[LifecycleManager] {message}");
} }
} }

View File

@@ -89,7 +89,6 @@ namespace Core.Lifecycle
public void InvokeSceneReady() => OnSceneReady(); public void InvokeSceneReady() => OnSceneReady();
public string InvokeSceneSaveRequested() => OnSceneSaveRequested(); public string InvokeSceneSaveRequested() => OnSceneSaveRequested();
public void InvokeSceneRestoreRequested(string data) => OnSceneRestoreRequested(data); public void InvokeSceneRestoreRequested(string data) => OnSceneRestoreRequested(data);
public void InvokeSceneRestoreCompleted() => OnSceneRestoreCompleted();
public string InvokeGlobalSaveRequested() => OnGlobalSaveRequested(); public string InvokeGlobalSaveRequested() => OnGlobalSaveRequested();
public void InvokeGlobalRestoreRequested(string data) => OnGlobalRestoreRequested(data); public void InvokeGlobalRestoreRequested(string data) => OnGlobalRestoreRequested(data);
public void InvokeManagedDestroy() => OnManagedDestroy(); public void InvokeManagedDestroy() => OnManagedDestroy();
@@ -119,7 +118,7 @@ namespace Core.Lifecycle
} }
else else
{ {
Logging.Warning($"[ManagedBehaviour] LifecycleManager not found for {gameObject.name}. Component will not receive lifecycle callbacks."); Debug.LogWarning($"[ManagedBehaviour] LifecycleManager not found for {gameObject.name}. Component will not receive lifecycle callbacks.");
} }
} }
@@ -203,10 +202,6 @@ namespace Core.Lifecycle
/// Called during scene transitions to restore scene-specific state. /// Called during scene transitions to restore scene-specific state.
/// Receives previously serialized data (from OnSceneSaveRequested). /// Receives previously serialized data (from OnSceneSaveRequested).
/// ///
/// IMPORTANT: This method MUST be synchronous. Do not use coroutines or async/await.
/// OnSceneRestoreCompleted is called immediately after all restore calls complete,
/// so any async operations would still be running when it fires.
///
/// TIMING: /// TIMING:
/// - Called AFTER scene load, during OnSceneReady phase /// - Called AFTER scene load, during OnSceneReady phase
/// - Frequency: Every scene transition /// - Frequency: Every scene transition
@@ -217,29 +212,6 @@ namespace Core.Lifecycle
// Default: no-op // Default: no-op
} }
/// <summary>
/// Called after all scene restore operations complete.
/// Does NOT receive data - use OnSceneRestoreRequested for that.
///
/// GUARANTEE:
/// - ALWAYS called after scene load, whether there's save data or not
/// - All OnSceneRestoreRequested() calls have RETURNED (but async operations may still be running)
/// - Safe for synchronous restore operations (JSON deserialization, setting fields, etc.)
///
/// TIMING:
/// - Called AFTER all OnSceneRestoreRequested calls complete (or immediately if no save data exists)
/// - Frequency: Every scene transition
/// - Use for: Post-restore initialization, first-time initialization, triggering events after state is restored
///
/// COMMON PATTERN:
/// Use this to perform actions that depend on whether data was restored or not.
/// Example: Play one-time audio only if it hasn't been played before (_hasPlayed == false).
/// </summary>
protected virtual void OnSceneRestoreCompleted()
{
// Default: no-op
}
/// <summary> /// <summary>
/// Called once on game boot to restore global persistent state. /// Called once on game boot to restore global persistent state.
/// Receives data that was saved via OnGlobalSaveRequested. /// Receives data that was saved via OnGlobalSaveRequested.

View File

@@ -88,7 +88,7 @@ namespace Core.SaveLoad
} }
else else
{ {
Logging.Warning($"[AppleMachine] SaveLoadManager not available for '{name}'"); Debug.LogWarning($"[AppleMachine] SaveLoadManager not available for '{name}'", this);
} }
} }
@@ -98,7 +98,7 @@ namespace Core.SaveLoad
// Optional: Log the auto-generated ID in verbose mode // Optional: Log the auto-generated ID in verbose mode
if (verbose && string.IsNullOrEmpty(customSaveId)) if (verbose && string.IsNullOrEmpty(customSaveId))
{ {
Logging.Debug($"[SaveableStateMachine] '{name}' will use auto-generated Save ID: {GetSaveId()}"); Debug.Log($"[SaveableStateMachine] '{name}' will use auto-generated Save ID: {GetSaveId()}", this);
} }
} }
#endif #endif
@@ -158,7 +158,7 @@ namespace Core.SaveLoad
{ {
if (verbose) if (verbose)
{ {
Logging.Warning($"[SaveableStateMachine] No data to restore for '{name}'"); Debug.LogWarning($"[SaveableStateMachine] No data to restore for '{name}'", this);
} }
return; return;
} }
@@ -171,7 +171,7 @@ namespace Core.SaveLoad
{ {
if (verbose) if (verbose)
{ {
Logging.Warning($"[SaveableStateMachine] No state name in save data for '{name}'"); Debug.LogWarning($"[SaveableStateMachine] No state name in save data for '{name}'", this);
} }
return; return;
} }
@@ -197,7 +197,7 @@ namespace Core.SaveLoad
if (verbose) if (verbose)
{ {
Logging.Debug($"[SaveableStateMachine] Restored '{name}' to state: {saveData.stateName}"); Debug.Log($"[SaveableStateMachine] Restored '{name}' to state: {saveData.stateName}", this);
} }
} }
catch (System.Exception ex) catch (System.Exception ex)
@@ -215,14 +215,14 @@ namespace Core.SaveLoad
[ContextMenu("Log Save ID")] [ContextMenu("Log Save ID")]
private void LogSaveId() private void LogSaveId()
{ {
Logging.Debug($"Save ID: {GetSaveId()}"); Debug.Log($"Save ID: {GetSaveId()}", this);
} }
[ContextMenu("Test Serialize")] [ContextMenu("Test Serialize")]
private void TestSerialize() private void TestSerialize()
{ {
string serialized = SerializeState(); string serialized = SerializeState();
Logging.Debug($"Serialized state: {serialized}"); Debug.Log($"Serialized state: {serialized}", this);
} }
#endif #endif

View File

@@ -504,19 +504,9 @@ namespace Core.SaveLoad
/// </summary> /// </summary>
public void RestoreSceneData() public void RestoreSceneData()
{ {
if (Lifecycle.LifecycleManager.Instance == null)
{
Logging.Warning("[SaveLoadManager] LifecycleManager not available for scene restore");
return;
}
if (currentSaveData == null || currentSaveData.participantStates == null) if (currentSaveData == null || currentSaveData.participantStates == null)
{ {
Logging.Debug("[SaveLoadManager] No scene data to restore (first visit or no save data)"); Logging.Debug("[SaveLoadManager] No scene data to restore");
// Still broadcast restore completed so components can initialize properly
Lifecycle.LifecycleManager.Instance.BroadcastSceneRestoreCompleted();
Logging.Debug($"[SaveLoadManager] Scene restore completed (no data)");
return; return;
} }
@@ -530,12 +520,11 @@ namespace Core.SaveLoad
} }
// Restore scene data via LifecycleManager // Restore scene data via LifecycleManager
if (Lifecycle.LifecycleManager.Instance != null)
{
Lifecycle.LifecycleManager.Instance.BroadcastSceneRestoreRequested(saveDataDict); Lifecycle.LifecycleManager.Instance.BroadcastSceneRestoreRequested(saveDataDict);
Logging.Debug($"[SaveLoadManager] Broadcast scene restore to LifecycleManager"); Logging.Debug($"[SaveLoadManager] Broadcast scene restore to LifecycleManager");
}
// Broadcast scene restore completed - ALWAYS called, whether there's data or not
Lifecycle.LifecycleManager.Instance.BroadcastSceneRestoreCompleted();
Logging.Debug($"[SaveLoadManager] Scene restore completed");
} }
/// <summary> /// <summary>
@@ -717,7 +706,7 @@ namespace Core.SaveLoad
{ {
IsSaving = false; IsSaving = false;
OnSaveCompleted?.Invoke(slot); OnSaveCompleted?.Invoke(slot);
Logging.Debug($"[SaveLoadManager] Save completed for slot '{slot}'"); Debug.Log($"[SaveLoadManager] Save completed for slot '{slot}'");
} }
} }

View File

@@ -81,7 +81,7 @@ namespace Core
{ {
if (string.IsNullOrEmpty(serializedData)) if (string.IsNullOrEmpty(serializedData))
{ {
Logging.Warning($"[SaveablePlayableDirector] No save data to restore for {gameObject.name}"); Debug.LogWarning($"[SaveablePlayableDirector] No save data to restore for {gameObject.name}");
return; return;
} }
@@ -99,7 +99,7 @@ namespace Core
_director.time = _director.duration; _director.time = _director.duration;
_director.Evaluate(); // Force evaluation to apply the state _director.Evaluate(); // Force evaluation to apply the state
Logging.Debug($"[SaveablePlayableDirector] Restored completed timeline '{gameObject.name}' - seeked to end"); Debug.Log($"[SaveablePlayableDirector] Restored completed timeline '{gameObject.name}' - seeked to end");
} }
else if (_hasPlayed && saveData.playbackTime > 0) else if (_hasPlayed && saveData.playbackTime > 0)
{ {
@@ -107,7 +107,7 @@ namespace Core
_director.time = saveData.playbackTime; _director.time = saveData.playbackTime;
_director.Evaluate(); _director.Evaluate();
Logging.Debug($"[SaveablePlayableDirector] Restored timeline '{gameObject.name}' at time {saveData.playbackTime}"); Debug.Log($"[SaveablePlayableDirector] Restored timeline '{gameObject.name}' at time {saveData.playbackTime}");
} }
else else
{ {
@@ -115,7 +115,7 @@ namespace Core
_director.time = 0; _director.time = 0;
_director.Evaluate(); _director.Evaluate();
Logging.Debug($"[SaveablePlayableDirector] Timeline '{gameObject.name}' not yet played - at start"); Debug.Log($"[SaveablePlayableDirector] Timeline '{gameObject.name}' not yet played - at start");
} }
} }

View File

@@ -1,4 +1,3 @@
using Core;
using UnityEngine; using UnityEngine;
using Core.Lifecycle; using Core.Lifecycle;
@@ -36,7 +35,7 @@ public class soundBird_CanFly : ManagedBehaviour
{ {
if (string.IsNullOrEmpty(serializedData)) if (string.IsNullOrEmpty(serializedData))
{ {
Logging.Warning($"[soundBird_CanFly] No save data to restore for {gameObject.name}"); Debug.LogWarning($"[soundBird_CanFly] No save data to restore for {gameObject.name}");
return; return;
} }
@@ -44,7 +43,7 @@ public class soundBird_CanFly : ManagedBehaviour
if (saveData != null) if (saveData != null)
{ {
canFly = saveData.canFly; canFly = saveData.canFly;
Logging.Debug($"[soundBird_CanFly] Restored canFly state: {canFly}"); Debug.Log($"[soundBird_CanFly] Restored canFly state: {canFly}");
} }
} }

View File

@@ -95,7 +95,6 @@ namespace AppleHills.Data.CardSystem
public enum CardZone public enum CardZone
{ {
NotApplicable,
AppleHills, AppleHills,
Quarry, Quarry,
CementFactory, CementFactory,

View File

@@ -190,7 +190,7 @@ namespace Interactions
/// <returns>True if interaction succeeded, false otherwise</returns> /// <returns>True if interaction succeeded, false otherwise</returns>
protected virtual bool DoInteraction() protected virtual bool DoInteraction()
{ {
Logging.Warning($"[Interactable] DoInteraction not implemented for {GetType().Name}"); Debug.LogWarning($"[Interactable] DoInteraction not implemented for {GetType().Name}");
return false; return false;
} }

View File

@@ -333,7 +333,7 @@ namespace Interactions
ItemSlotSaveData data = JsonUtility.FromJson<ItemSlotSaveData>(serializedData); ItemSlotSaveData data = JsonUtility.FromJson<ItemSlotSaveData>(serializedData);
if (data == null) if (data == null)
{ {
Logging.Warning($"[ItemSlot] Failed to deserialize save data for {gameObject.name}"); Debug.LogWarning($"[ItemSlot] Failed to deserialize save data for {gameObject.name}");
return; return;
} }
@@ -343,7 +343,7 @@ namespace Interactions
// Restore slotted item if there was one // Restore slotted item if there was one
if (!string.IsNullOrEmpty(data.slottedItemSaveId)) if (!string.IsNullOrEmpty(data.slottedItemSaveId))
{ {
Logging.Debug($"[ItemSlot] Restoring slotted item: {data.slottedItemSaveId} (itemId: {data.slottedItemDataId})"); Debug.Log($"[ItemSlot] Restoring slotted item: {data.slottedItemSaveId} (itemId: {data.slottedItemDataId})");
RestoreSlottedItem(data.slottedItemSaveId, data.slottedItemDataId); RestoreSlottedItem(data.slottedItemSaveId, data.slottedItemDataId);
} }
} }
@@ -361,7 +361,7 @@ namespace Interactions
{ {
// Item not found in scene - it might be a dynamically spawned combined item // Item not found in scene - it might be a dynamically spawned combined item
// Try to spawn it from the itemDataId // Try to spawn it from the itemDataId
Logging.Debug($"[ItemSlot] Slotted item not found in scene: {slottedItemSaveId}, attempting to spawn from itemId: {expectedItemDataId}"); Debug.Log($"[ItemSlot] Slotted item not found in scene: {slottedItemSaveId}, attempting to spawn from itemId: {expectedItemDataId}");
GameObject prefab = interactionSettings?.FindPickupPrefabByItemId(expectedItemDataId); GameObject prefab = interactionSettings?.FindPickupPrefabByItemId(expectedItemDataId);
if (prefab != null) if (prefab != null)
@@ -369,17 +369,17 @@ namespace Interactions
// Spawn the item (inactive, since it will be slotted) // Spawn the item (inactive, since it will be slotted)
slottedObject = Instantiate(prefab, transform.position, Quaternion.identity); slottedObject = Instantiate(prefab, transform.position, Quaternion.identity);
slottedObject.SetActive(false); slottedObject.SetActive(false);
Logging.Debug($"[ItemSlot] Successfully spawned combined item for slot: {expectedItemDataId}"); Debug.Log($"[ItemSlot] Successfully spawned combined item for slot: {expectedItemDataId}");
} }
else else
{ {
Logging.Warning($"[ItemSlot] Could not find prefab for itemId: {expectedItemDataId}"); Debug.LogWarning($"[ItemSlot] Could not find prefab for itemId: {expectedItemDataId}");
return; return;
} }
} }
else if (slottedObject == null) else if (slottedObject == null)
{ {
Logging.Warning($"[ItemSlot] Could not find slotted item with save ID: {slottedItemSaveId}"); Debug.LogWarning($"[ItemSlot] Could not find slotted item with save ID: {slottedItemSaveId}");
return; return;
} }
@@ -395,13 +395,13 @@ namespace Interactions
{ {
if (slottedData.itemId != expectedItemDataId) if (slottedData.itemId != expectedItemDataId)
{ {
Logging.Warning($"[ItemSlot] ItemId mismatch! Pickup has '{slottedData.itemId}' but expected '{expectedItemDataId}'"); Debug.LogWarning($"[ItemSlot] ItemId mismatch! Pickup has '{slottedData.itemId}' but expected '{expectedItemDataId}'");
} }
} }
if (slottedData == null) if (slottedData == null)
{ {
Logging.Warning($"[ItemSlot] Pickup {pickup.gameObject.name} has null itemData! Expected itemId: {expectedItemDataId}"); Debug.LogWarning($"[ItemSlot] Pickup {pickup.gameObject.name} has null itemData! Expected itemId: {expectedItemDataId}");
if (slottedObject != null) if (slottedObject != null)
Destroy(slottedObject); Destroy(slottedObject);
return; return;
@@ -409,7 +409,7 @@ namespace Interactions
} }
else else
{ {
Logging.Warning($"[ItemSlot] Slotted object has no Pickup component: {slottedObject.name}"); Debug.LogWarning($"[ItemSlot] Slotted object has no Pickup component: {slottedObject.name}");
if (slottedObject != null) if (slottedObject != null)
Destroy(slottedObject); Destroy(slottedObject);
return; return;
@@ -419,7 +419,7 @@ namespace Interactions
// Follower state is managed separately during save/load restoration // Follower state is managed separately during save/load restoration
ApplySlottedItemState(slottedObject, slottedData, triggerEvents: false); ApplySlottedItemState(slottedObject, slottedData, triggerEvents: false);
Logging.Debug($"[ItemSlot] Successfully restored slotted item: {slottedData.itemName} (itemId: {slottedData.itemId})"); Debug.Log($"[ItemSlot] Successfully restored slotted item: {slottedData.itemName} (itemId: {slottedData.itemId})");
} }
/// <summary> /// <summary>
@@ -526,7 +526,7 @@ namespace Interactions
// If slot already has an item, reject the claim // If slot already has an item, reject the claim
if (currentlySlottedItemObject != null) if (currentlySlottedItemObject != null)
{ {
Logging.Warning($"[ItemSlot] Already has a slotted item, rejecting claim from {pickup.gameObject.name}"); Debug.LogWarning($"[ItemSlot] Already has a slotted item, rejecting claim from {pickup.gameObject.name}");
return false; return false;
} }
@@ -537,7 +537,7 @@ namespace Interactions
// Claim the pickup // Claim the pickup
ApplySlottedItemState(pickup.gameObject, pickup.itemData, triggerEvents: false); ApplySlottedItemState(pickup.gameObject, pickup.itemData, triggerEvents: false);
Logging.Debug($"[ItemSlot] Successfully claimed slotted item: {pickup.itemData?.itemName}"); Debug.Log($"[ItemSlot] Successfully claimed slotted item: {pickup.itemData?.itemName}");
return true; return true;
} }

View File

@@ -166,7 +166,7 @@ namespace Interactions
PickupSaveData data = JsonUtility.FromJson<PickupSaveData>(serializedData); PickupSaveData data = JsonUtility.FromJson<PickupSaveData>(serializedData);
if (data == null) if (data == null)
{ {
Logging.Warning($"[Pickup] Failed to deserialize save data for {gameObject.name}"); Debug.LogWarning($"[Pickup] Failed to deserialize save data for {gameObject.name}");
return; return;
} }
@@ -200,7 +200,7 @@ namespace Interactions
} }
else else
{ {
Logging.Warning($"[Pickup] Could not find slot with SaveId: {data.slotSaveId}"); Debug.LogWarning($"[Pickup] Could not find slot with SaveId: {data.slotSaveId}");
} }
} }
} }

View File

@@ -1,5 +1,4 @@
using Core; using UnityEngine;
using UnityEngine;
namespace Interactions namespace Interactions
{ {
@@ -39,7 +38,7 @@ namespace Interactions
{ {
if (string.IsNullOrEmpty(serializedData)) if (string.IsNullOrEmpty(serializedData))
{ {
Logging.Warning($"[SaveableInteractable] Empty save data for {SaveId}"); Debug.LogWarning($"[SaveableInteractable] Empty save data for {SaveId}");
return; return;
} }
@@ -86,17 +85,17 @@ namespace Interactions
[ContextMenu("Log Save ID")] [ContextMenu("Log Save ID")]
private void LogSaveId() private void LogSaveId()
{ {
Logging.Debug($"Save ID: {SaveId}"); Debug.Log($"Save ID: {SaveId}");
} }
[ContextMenu("Test Serialize/Deserialize")] [ContextMenu("Test Serialize/Deserialize")]
private void TestSerializeDeserialize() private void TestSerializeDeserialize()
{ {
string serialized = OnSceneSaveRequested(); string serialized = OnSceneSaveRequested();
Logging.Debug($"Serialized state: {serialized}"); Debug.Log($"Serialized state: {serialized}");
OnSceneRestoreRequested(serialized); OnSceneRestoreRequested(serialized);
Logging.Debug("Deserialization test complete"); Debug.Log("Deserialization test complete");
} }
#endif #endif

View File

@@ -25,7 +25,7 @@ namespace Levels
{ {
base.Awake(); base.Awake();
Logging.Debug($"[LevelSwitch] Awake called for {gameObject.name} in scene {gameObject.scene.name}"); Debug.Log($"[LevelSwitch] Awake called for {gameObject.name} in scene {gameObject.scene.name}");
if (_iconRenderer == null) if (_iconRenderer == null)
_iconRenderer = GetComponent<SpriteRenderer>(); _iconRenderer = GetComponent<SpriteRenderer>();
@@ -38,12 +38,12 @@ namespace Levels
protected override void OnManagedAwake() protected override void OnManagedAwake()
{ {
Logging.Debug($"[LevelSwitch] OnManagedAwake called for {gameObject.name}"); Debug.Log($"[LevelSwitch] OnManagedAwake called for {gameObject.name}");
} }
protected override void OnSceneReady() protected override void OnSceneReady()
{ {
Logging.Debug($"[LevelSwitch] OnSceneReady called for {gameObject.name}"); Debug.Log($"[LevelSwitch] OnSceneReady called for {gameObject.name}");
} }
#if UNITY_EDITOR #if UNITY_EDITOR
@@ -79,7 +79,7 @@ namespace Levels
{ {
if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName)) if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName))
{ {
Logging.Warning("LevelSwitch has no valid switchData!"); Debug.LogWarning("LevelSwitch has no valid switchData!");
return false; return false;
} }

View File

@@ -160,7 +160,7 @@ namespace Levels
{ {
if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName)) if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName))
{ {
Logging.Warning("MinigameSwitch has no valid switchData!"); Debug.LogWarning("MinigameSwitch has no valid switchData!");
return false; return false;
} }
@@ -231,7 +231,7 @@ namespace Levels
MinigameSwitchSaveData data = JsonUtility.FromJson<MinigameSwitchSaveData>(serializedData); MinigameSwitchSaveData data = JsonUtility.FromJson<MinigameSwitchSaveData>(serializedData);
if (data == null) if (data == null)
{ {
Logging.Warning($"[MinigameSwitch] Failed to deserialize save data for {gameObject.name}"); Debug.LogWarning($"[MinigameSwitch] Failed to deserialize save data for {gameObject.name}");
return; return;
} }

View File

@@ -1,24 +1,13 @@
using System;
using Core;
using Core.Lifecycle;
using UnityEngine; using UnityEngine;
namespace PuzzleS public class BirdGameStats : MonoBehaviour
{ {
/// <summary>
/// Tracks bird discovery progress in the bird finding minigame.
/// Saves scene-specific progress using the ManagedBehaviour lifecycle system.
/// </summary>
public class BirdGameStats : ManagedBehaviour
{
public int birdsFoundInLevel; public int birdsFoundInLevel;
// Save system configuration // Start is called once before the first execution of Update after the MonoBehaviour is created
public override bool AutoRegisterForSave => true; void Start()
protected override void OnManagedAwake()
{ {
// Initialize after all managers are ready
} }
public void BirdFound() public void BirdFound()
@@ -26,49 +15,5 @@ namespace PuzzleS
birdsFoundInLevel += 1; birdsFoundInLevel += 1;
} }
#region Save/Load Lifecycle Hooks
protected override string OnSceneSaveRequested()
{
// Save scene-specific progress
var state = new BirdGameState
{
birdsFoundInLevel = this.birdsFoundInLevel
};
return JsonUtility.ToJson(state);
}
protected override void OnSceneRestoreRequested(string serializedData)
{
if (string.IsNullOrEmpty(serializedData))
{
// No saved data, keep default values
return;
}
try
{
var state = JsonUtility.FromJson<BirdGameState>(serializedData);
if (state != null)
{
birdsFoundInLevel = state.birdsFoundInLevel;
}
}
catch (Exception ex)
{
Logging.Warning($"[BirdGameStats] Failed to restore state: {ex.Message}");
}
}
#endregion
}
/// <summary>
/// Serializable state for bird game progress
/// </summary>
[Serializable]
public class BirdGameState
{
public int birdsFoundInLevel;
}
} }

View File

@@ -613,7 +613,7 @@ namespace PuzzleS
protected override void OnSceneRestoreRequested(string data) protected override void OnSceneRestoreRequested(string data)
{ {
Logging.Debug("[XAXA] PuzzleManager loading with data: " + data); Debug.Log("[XAXA] PuzzleManager loading with data: " + data);
if (string.IsNullOrEmpty(data) || data == "{}") if (string.IsNullOrEmpty(data) || data == "{}")
{ {

View File

@@ -3,14 +3,12 @@ using System;
using System.Diagnostics.Tracing; using System.Diagnostics.Tracing;
using UnityEngine; using UnityEngine;
using UnityEngine.Audio; using UnityEngine.Audio;
using Core;
using Core.Lifecycle;
/// <summary> /// <summary>
/// We automatically add the AudioSource component here so we can control it. Do not add it manually! /// We automatically add the AudioSource component here so we can control it. Do not add it manually!
/// </summary> /// </summary>
[RequireComponent(typeof(AudioSource))] [RequireComponent(typeof(AudioSource))]
public class AppleAudioSource : ManagedBehaviour public class AppleAudioSource : MonoBehaviour
{ {
public enum AudioSourceType{CriticalVO,VO,Ambience,SFX,Music} public enum AudioSourceType{CriticalVO,VO,Ambience,SFX,Music}
public AudioSourceType audioSourceType; public AudioSourceType audioSourceType;
@@ -19,14 +17,8 @@ public class AppleAudioSource : ManagedBehaviour
[HideInInspector ] public int clipPriority; [HideInInspector ] public int clipPriority;
public int sourcePriority; public int sourcePriority;
protected override void Awake()
{
base.Awake();
audioSource = GetComponent<AudioSource>();
}
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
protected override void OnManagedAwake() void OnEnable()
{ {
audioSource = GetComponent<AudioSource>(); audioSource = GetComponent<AudioSource>();
AudioManager.Instance.RegisterNewAudioSource(this); AudioManager.Instance.RegisterNewAudioSource(this);
@@ -62,10 +54,6 @@ public class AppleAudioSource : ManagedBehaviour
public void Play(int requestedClipPriority) public void Play(int requestedClipPriority)
{ {
if (audioSource == null)
{
audioSource = GetComponent<AudioSource>();
}
clipPriority = requestedClipPriority; clipPriority = requestedClipPriority;
if (audioSourceType == AudioSourceType.CriticalVO || audioSourceType == AudioSourceType.VO) if (audioSourceType == AudioSourceType.CriticalVO || audioSourceType == AudioSourceType.VO)
{ {
@@ -75,7 +63,7 @@ public class AppleAudioSource : ManagedBehaviour
} }
else else
{ {
Logging.Debug("[AUDIOMANAGER] AppleAudioSource " + name + " was suppressed because something more important is playing"); Debug.Log("[AUDIOMANAGER] AppleAudioSource " + name + " was suppressed because something more important is playing");
} }
} }
else else

View File

@@ -5,7 +5,6 @@ using AppleHills.Core.Interfaces;
using System.Collections.Generic; using System.Collections.Generic;
using AudioSourceEvents; using AudioSourceEvents;
using System; using System;
using Core;
using Core.Lifecycle; using Core.Lifecycle;
public class AudioManager : ManagedBehaviour, IPausable public class AudioManager : ManagedBehaviour, IPausable
@@ -72,14 +71,16 @@ public class AudioManager : ManagedBehaviour, IPausable
} }
else else
{ {
Logging.Warning("[AudioManager] QuickAccess.Instance is null during OnManagedAwake. Some audio references may remain unset."); Debug.LogWarning("[AudioManager] QuickAccess.Instance is null during OnManagedAwake. Some audio references may remain unset.");
} }
// Diagnostic // Diagnostic
foreach (AppleAudioSource _audioSource in criticalVOSources) foreach (AppleAudioSource _audioSource in criticalVOSources)
{ {
Logging.Debug("Found source: " + _audioSource.name); Debug.Log("Found source: " + _audioSource.name);
} }
Debug.Log("[AudioManager] OnManagedAwake completed");
} }
public void SetAudioPauseBehavior(PauseBehavior newPauseBehavior) public void SetAudioPauseBehavior(PauseBehavior newPauseBehavior)
@@ -103,15 +104,15 @@ public class AudioManager : ManagedBehaviour, IPausable
public LevelAudioObject GetCurrentLevelAudioObject() public LevelAudioObject GetCurrentLevelAudioObject()
{ {
Logging.Debug("Audio objects: " + FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length); Debug.Log("Audio objects: " + FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length);
if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length > 1) if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length > 1)
{ {
Logging.Warning("Warning! More than one LevelAudioObject in the level! Using the first one found"); Debug.LogWarning("Warning! More than one LevelAudioObject in the level! Using the first one found");
return FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None)[0]; return FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None)[0];
} }
if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length == 0) if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length == 0)
{ {
Logging.Warning("Error! No LevelAudioObject found, AudioManager might not function properly!"); Debug.LogWarning("Error! No LevelAudioObject found, AudioManager might not function properly!");
return null; return null;
} }
else else
@@ -157,10 +158,12 @@ public class AudioManager : ManagedBehaviour, IPausable
/// </summary> /// </summary>
public bool RequestPlayVO(AppleAudioSource requestedAudioSource) public bool RequestPlayVO(AppleAudioSource requestedAudioSource)
{ {
//Debug.Log($"[AUDIOMANAGER] CurrentVO source prio: {currentlyPlayingVO.sourcePriority}, clip prio: {currentlyPlayingVO.clipPriority} requested VO prio: {requestedAudioSource.sourcePriority}, clip prio: {clipPriority}");
// If nothing is playing, let the requested audio source play // If nothing is playing, let the requested audio source play
if (currentlyPlayingVO == null) if (currentlyPlayingVO == null)
{ {
SetupNewAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] Playing {currentlyPlayingVO.name} as nothing is currently playing.");
return true; return true;
} }
@@ -174,6 +177,7 @@ public class AudioManager : ManagedBehaviour, IPausable
{ {
InterruptAudioSource(requestedAudioSource); InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is the same as {requestedAudioSource.name}. Triggering it again.");
return true; return true;
} }
@@ -183,6 +187,7 @@ public class AudioManager : ManagedBehaviour, IPausable
InterruptAudioSource(requestedAudioSource); InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is not critical. Playing {requestedAudioSource.name} instead because it is critical.");
return true; return true;
} }
// If the requested audio source has the same priority as currently playing source, check the priority of the requested clip // If the requested audio source has the same priority as currently playing source, check the priority of the requested clip
@@ -192,6 +197,8 @@ public class AudioManager : ManagedBehaviour, IPausable
{ {
InterruptAudioSource(requestedAudioSource); InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] Interrupted {currentlyPlayingVO.name} because it has same priority as {requestedAudioSource.name} but the requested clip has higher priority");
return true; return true;
} }
else else
@@ -203,6 +210,7 @@ public class AudioManager : ManagedBehaviour, IPausable
if (currentlyPlayingVO.audioSourceType == AppleAudioSource.AudioSourceType.CriticalVO && currentlyPlayingVO.sourcePriority > requestedAudioSource.sourcePriority) if (currentlyPlayingVO.audioSourceType == AppleAudioSource.AudioSourceType.CriticalVO && currentlyPlayingVO.sourcePriority > requestedAudioSource.sourcePriority)
{ {
currentlyPlayingVO.InterruptAudio(requestedAudioSource.name); currentlyPlayingVO.InterruptAudio(requestedAudioSource.name);
Debug.Log($"[AUDIOMANAGER] Interrupted {currentlyPlayingVO.name} because {requestedAudioSource.name} has higher priority");
InterruptAudioSource(requestedAudioSource); InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource); SetupNewAudioSource(requestedAudioSource);
return true; return true;
@@ -210,6 +218,7 @@ public class AudioManager : ManagedBehaviour, IPausable
// If the requested audio source didn't clear any of the above cases, tell it to get rekt. // If the requested audio source didn't clear any of the above cases, tell it to get rekt.
else else
{ {
Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is still playing. {requestedAudioSource.name} has lower priority");
return false; return false;
} }
} }
@@ -223,6 +232,7 @@ public class AudioManager : ManagedBehaviour, IPausable
{ {
if (audioSource.audioSource.resource == null) if (audioSource.audioSource.resource == null)
{ {
Debug.Log($"[AUDIOMANAGER] Faled to setup {audioSource.name}. Invalid resource");
} }
else else
{ {
@@ -270,16 +280,8 @@ public class AudioManager : ManagedBehaviour, IPausable
private void InterruptAllVOSources() private void InterruptAllVOSources()
{ {
foreach (AppleAudioSource source in criticalVOSources) foreach (AppleAudioSource source in criticalVOSources)
{
if (source == null)
{
return;
}
else
{ {
source.InterruptAudio("GlobalInterrupt"); source.InterruptAudio("GlobalInterrupt");
}
} }
foreach (AppleAudioSource source in VOSources) foreach (AppleAudioSource source in VOSources)

View File

@@ -4,11 +4,8 @@ using System;
using System.Diagnostics.Tracing; using System.Diagnostics.Tracing;
using UnityEngine; using UnityEngine;
using UnityEngine.Audio; using UnityEngine.Audio;
using Core;
using Core.Lifecycle;
using PuzzleS;
public class BushAudioController : ManagedBehaviour public class BushAudioController : MonoBehaviour
{ {
private IAudioEventSource _eventSource; private IAudioEventSource _eventSource;
public AppleAudioSource VOPlayer; public AppleAudioSource VOPlayer;
@@ -23,7 +20,7 @@ public class BushAudioController : ManagedBehaviour
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
protected override void OnManagedAwake() void Start()
{ {
_eventSource = VOPlayer.audioSource.RequestEventHandlers(); _eventSource = VOPlayer.audioSource.RequestEventHandlers();
_eventSource.AudioStopped += PlayBirdCounter; _eventSource.AudioStopped += PlayBirdCounter;
@@ -51,9 +48,9 @@ public class BushAudioController : ManagedBehaviour
} }
//public void OnDisable() public void OnDisable()
//{ {
// // Unsubscribe from events when disabled // Unsubscribe from events when disabled
// _eventSource.AudioStopped -= PlayBirdCounter; _eventSource.AudioStopped -= PlayBirdCounter;
//} }
} }

View File

@@ -1,81 +1,22 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Audio; using UnityEngine.Audio;
using System; using System;
using Core;
using Core.Lifecycle;
[Serializable] public class LevelAudioObject : MonoBehaviour
public class LevelAudioObjectSaveData
{ {
public bool hasPlayed;
}
public class LevelAudioObject : ManagedBehaviour
{
[Header("Audio Settings")]
public AppleAudioSource narratorAudioSource; public AppleAudioSource narratorAudioSource;
public AudioResource firstNarration; public AudioResource firstNarration;
[Header("Playback Settings")] // Start is called once before the first execution of Update after the MonoBehaviour is created
[Tooltip("If true, the audio will only play once and never again after being played")] void Start()
public bool isOneTime;
private bool _hasPlayed;
#region ManagedBehaviour Overrides
public override bool AutoRegisterForSave => isOneTime; // Only save if one-time audio
protected override string OnSceneSaveRequested()
{
if (!isOneTime)
return null; // No need to save if not one-time
LevelAudioObjectSaveData saveData = new LevelAudioObjectSaveData
{
hasPlayed = _hasPlayed
};
return JsonUtility.ToJson(saveData);
}
protected override void OnSceneRestoreRequested(string serializedData)
{
if (!isOneTime || string.IsNullOrEmpty(serializedData))
return;
try
{
LevelAudioObjectSaveData saveData = JsonUtility.FromJson<LevelAudioObjectSaveData>(serializedData);
_hasPlayed = saveData.hasPlayed;
}
catch (Exception e)
{
Logging.Warning($"[LevelAudioObject] Failed to restore audio state: {e.Message}");
}
}
protected override void OnSceneRestoreCompleted()
{
if (isOneTime && !_hasPlayed)
{ {
PlayNarrationAudio(); PlayNarrationAudio();
} }
}
#endregion void PlayNarrationAudio()
private void PlayNarrationAudio()
{ {
if (narratorAudioSource == null || firstNarration == null)
{
Logging.Warning($"[LevelAudioObject] Missing audio source or narration resource on {gameObject.name}");
return;
}
narratorAudioSource.audioSource.resource = firstNarration; narratorAudioSource.audioSource.resource = firstNarration;
narratorAudioSource.Play(0); narratorAudioSource.Play(0);
_hasPlayed = true;
} }
} }

View File

@@ -1,4 +1,3 @@
using Core;
using UnityEngine; using UnityEngine;
public class ProximitySoundReaction : MonoBehaviour public class ProximitySoundReaction : MonoBehaviour
@@ -13,13 +12,13 @@ public class ProximitySoundReaction : MonoBehaviour
private void OnCollisionEnter2D(Collision2D collision) private void OnCollisionEnter2D(Collision2D collision)
{ {
Logging.Debug("overlap!"); Debug.Log("overlap!");
} }
private void OnTriggerEnter2D(Collider2D collision) private void OnTriggerEnter2D(Collider2D collision)
{ {
Logging.Debug("Wolter triggered!"); Debug.Log("Wolter triggered!");
} }

View File

@@ -1,17 +1,18 @@
using Core; using Core;
using Core.Lifecycle;
using UnityEngine; using UnityEngine;
using UnityEngine.Audio; using UnityEngine.Audio;
public class PulverAudioController : ManagedBehaviour public class PulverAudioController : MonoBehaviour
{ {
public AppleAudioSource audioSource; private AppleAudioSource audioSource;
public AudioResource combineAudio; public AudioResource combineAudio;
private FollowerController followerController; private FollowerController followerController;
public ItemManager itemManager; public ItemManager itemManager;
protected override void OnManagedAwake() // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{ {
audioSource = GetComponent<AppleAudioSource>();
followerController = GetComponent<FollowerController>(); followerController = GetComponent<FollowerController>();
followerController.PulverIsCombining.AddListener(PulverIsCombining); followerController.PulverIsCombining.AddListener(PulverIsCombining);

View File

@@ -1,6 +1,5 @@
using System; using System;
using AppleHills.Data.CardSystem; using AppleHills.Data.CardSystem;
using Core;
using Pixelplacement; using Pixelplacement;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
@@ -83,37 +82,37 @@ namespace UI.CardSystem
/// </summary> /// </summary>
public void OnPointerClick(PointerEventData eventData) public void OnPointerClick(PointerEventData eventData)
{ {
Logging.Debug($"[CLICK-TRACE-ALBUMCARD] OnPointerClick on {name}, _parentSlot={((_parentSlot != null) ? _parentSlot.name : "NULL")}, _isEnlarged={_isEnlarged}, position={eventData.position}"); Debug.Log($"[CLICK-TRACE-ALBUMCARD] OnPointerClick on {name}, _parentSlot={((_parentSlot != null) ? _parentSlot.name : "NULL")}, _isEnlarged={_isEnlarged}, position={eventData.position}");
// During reveal flow (before placed in slot), forward clicks to parent FlippableCard // During reveal flow (before placed in slot), forward clicks to parent FlippableCard
if (_parentSlot == null) if (_parentSlot == null)
{ {
Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - No parent slot, forwarding click to parent FlippableCard"); Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - No parent slot, forwarding click to parent FlippableCard");
// Find parent FlippableCard and forward the click // Find parent FlippableCard and forward the click
FlippableCard parentFlippable = GetComponentInParent<FlippableCard>(); FlippableCard parentFlippable = GetComponentInParent<FlippableCard>();
if (parentFlippable != null) if (parentFlippable != null)
{ {
Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Found parent FlippableCard, calling OnPointerClick"); Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Found parent FlippableCard, calling OnPointerClick");
parentFlippable.OnPointerClick(eventData); parentFlippable.OnPointerClick(eventData);
} }
else else
{ {
Logging.Warning($"[CLICK-TRACE-ALBUMCARD] {name} - No parent FlippableCard found!"); Debug.LogWarning($"[CLICK-TRACE-ALBUMCARD] {name} - No parent FlippableCard found!");
} }
return; return;
} }
Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Has parent slot, processing click"); Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Has parent slot, processing click");
if (_isEnlarged) if (_isEnlarged)
{ {
Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Is enlarged, requesting shrink"); Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Is enlarged, requesting shrink");
OnShrinkRequested?.Invoke(this); OnShrinkRequested?.Invoke(this);
} }
else else
{ {
Logging.Debug($"[CLICK-TRACE-ALBUMCARD] {name} - Is normal size, requesting enlarge"); Debug.Log($"[CLICK-TRACE-ALBUMCARD] {name} - Is normal size, requesting enlarge");
OnEnlargeRequested?.Invoke(this); OnEnlargeRequested?.Invoke(this);
} }
} }

View File

@@ -24,9 +24,7 @@ namespace UI.CardSystem
[SerializeField] private BookCurlPro.BookPro book; [SerializeField] private BookCurlPro.BookPro book;
[Header("Zone Navigation")] [Header("Zone Navigation")]
[SerializeField] private Transform tabContainer; // Container holding all BookTabButton children [SerializeField] private BookTabButton[] zoneTabs; // All zone tab buttons
private BookTabButton[] zoneTabs; // Discovered zone tab buttons
[Header("Album Card Reveal")] [Header("Album Card Reveal")]
[SerializeField] private SlotContainer bottomRightSlots; [SerializeField] private SlotContainer bottomRightSlots;
@@ -48,9 +46,6 @@ namespace UI.CardSystem
{ {
base.OnManagedAwake(); base.OnManagedAwake();
// Discover zone tabs from container
DiscoverZoneTabs();
// Make sure we have a CanvasGroup for transitions // Make sure we have a CanvasGroup for transitions
if (canvasGroup == null) if (canvasGroup == null)
canvasGroup = GetComponent<CanvasGroup>(); canvasGroup = GetComponent<CanvasGroup>();
@@ -72,17 +67,6 @@ namespace UI.CardSystem
// Set up booster pack button listeners // Set up booster pack button listeners
SetupBoosterButtonListeners(); SetupBoosterButtonListeners();
// Subscribe to book page flip events
if (book != null)
{
book.OnFlip.AddListener(OnPageFlipped);
Logging.Debug("[AlbumViewPage] Subscribed to book.OnFlip event");
}
else
{
Logging.Warning("[AlbumViewPage] Book reference is null, cannot subscribe to OnFlip event!");
}
// Subscribe to CardSystemManager events (managers are guaranteed to be initialized) // Subscribe to CardSystemManager events (managers are guaranteed to be initialized)
if (CardSystemManager.Instance != null) if (CardSystemManager.Instance != null)
{ {
@@ -99,36 +83,6 @@ namespace UI.CardSystem
gameObject.SetActive(false); gameObject.SetActive(false);
} }
/// <summary>
/// Discover all BookTabButton components from the tab container
/// </summary>
private void DiscoverZoneTabs()
{
if (tabContainer == null)
{
Debug.LogError("[AlbumViewPage] Tab container is not assigned! Cannot discover zone tabs.");
zoneTabs = new BookTabButton[0];
return;
}
// Get all BookTabButton components from children
zoneTabs = tabContainer.GetComponentsInChildren<BookTabButton>(includeInactive: false);
if (zoneTabs == null || zoneTabs.Length == 0)
{
Logging.Warning($"[AlbumViewPage] No BookTabButton components found in tab container '{tabContainer.name}'!");
zoneTabs = new BookTabButton[0];
}
else
{
Logging.Debug($"[AlbumViewPage] Discovered {zoneTabs.Length} zone tabs from container '{tabContainer.name}'");
foreach (var tab in zoneTabs)
{
Logging.Debug($" - Tab: {tab.name}, Zone: {tab.Zone}, TargetPage: {tab.TargetPage}");
}
}
}
private void SetupBoosterButtonListeners() private void SetupBoosterButtonListeners()
{ {
if (boosterPackButtons == null) return; if (boosterPackButtons == null) return;
@@ -136,12 +90,6 @@ namespace UI.CardSystem
for (int i = 0; i < boosterPackButtons.Length; i++) for (int i = 0; i < boosterPackButtons.Length; i++)
{ {
if (boosterPackButtons[i] == null) continue; if (boosterPackButtons[i] == null) continue;
// Unsubscribe from book events
if (book != null)
{
book.OnFlip.RemoveListener(OnPageFlipped);
}
Button button = boosterPackButtons[i].GetComponent<Button>(); Button button = boosterPackButtons[i].GetComponent<Button>();
if (button != null) if (button != null)
@@ -209,7 +157,7 @@ namespace UI.CardSystem
if (Input.InputManager.Instance != null) if (Input.InputManager.Instance != null)
{ {
Input.InputManager.Instance.SetInputMode(_previousInputMode); Input.InputManager.Instance.SetInputMode(_previousInputMode);
Logging.Debug($"[AlbumViewPage] Restored input mode to {_previousInputMode} on exit"); Debug.Log($"[AlbumViewPage] Restored input mode to {_previousInputMode} on exit");
} }
if (UIPageController.Instance != null) if (UIPageController.Instance != null)
@@ -260,7 +208,7 @@ namespace UI.CardSystem
// Store the current input mode before switching // Store the current input mode before switching
_previousInputMode = Input.InputMode.GameAndUI; _previousInputMode = Input.InputMode.GameAndUI;
Input.InputManager.Instance.SetInputMode(Input.InputMode.UI); Input.InputManager.Instance.SetInputMode(Input.InputMode.UI);
Logging.Debug("[AlbumViewPage] Switched to UI-only input mode on first entry"); Debug.Log("[AlbumViewPage] Switched to UI-only input mode on first entry");
} }
// Subscribe to pending card events while page is active // Subscribe to pending card events while page is active
@@ -269,16 +217,8 @@ namespace UI.CardSystem
CardSystemManager.Instance.OnPendingCardAdded += OnPendingCardAdded; CardSystemManager.Instance.OnPendingCardAdded += OnPendingCardAdded;
} }
// Only spawn pending cards if we're already on an album page (not the menu) // Spawn pending cards when opening album
if (IsInAlbumProper())
{
Logging.Debug("[AlbumViewPage] Opening directly to album page - spawning cards immediately");
SpawnPendingCards(); SpawnPendingCards();
}
else
{
Logging.Debug("[AlbumViewPage] Opening to menu page - cards will spawn when entering album");
}
base.TransitionIn(); base.TransitionIn();
} }
@@ -291,9 +231,6 @@ namespace UI.CardSystem
CardSystemManager.Instance.OnPendingCardAdded -= OnPendingCardAdded; CardSystemManager.Instance.OnPendingCardAdded -= OnPendingCardAdded;
} }
// Clean up active pending cards to prevent duplicates on next opening
CleanupActiveCards();
// Don't restore input mode here - only restore when actually exiting (in OnExitButtonClicked) // Don't restore input mode here - only restore when actually exiting (in OnExitButtonClicked)
base.TransitionOut(); base.TransitionOut();
} }
@@ -367,46 +304,6 @@ namespace UI.CardSystem
} }
} }
/// <summary>
/// Check if we're currently viewing the album proper (not the menu page)
/// </summary>
private bool IsInAlbumProper()
{
if (book == null)
{
Logging.Warning("[AlbumViewPage] Book reference is null in IsInAlbumProper check");
return false;
}
// Page 1 is the menu/cover, page 2+ are album pages with card slots
bool inAlbum = book.CurrentPaper > 1;
return inAlbum;
}
/// <summary>
/// Called when book page flips - show/hide pending cards based on whether we're in the album proper
/// </summary>
private void OnPageFlipped()
{
bool isInAlbum = IsInAlbumProper();
if (isInAlbum && _activeCards.Count == 0)
{
// Entering album proper and no cards spawned yet - spawn them with animation
Logging.Debug("[AlbumViewPage] Entering album proper - spawning pending cards with animation");
SpawnPendingCards();
}
else if (!isInAlbum && _activeCards.Count > 0)
{
// Returning to menu page - cleanup cards
Logging.Debug("[AlbumViewPage] Returning to menu page - cleaning up pending cards");
CleanupActiveCards();
}
else
{
Logging.Debug($"[AlbumViewPage] Page flipped but no card state change needed (already in correct state)");
}
}
#region Album Card Reveal System #region Album Card Reveal System
/// <summary> /// <summary>
@@ -430,7 +327,7 @@ namespace UI.CardSystem
int spawnCount = Mathf.Min(uniquePending.Count, MAX_VISIBLE_CARDS); int spawnCount = Mathf.Min(uniquePending.Count, MAX_VISIBLE_CARDS);
Logging.Debug($"[AlbumViewPage] Spawning {spawnCount} unique pending cards (total pending: {pending.Count})"); Debug.Log($"[AlbumViewPage] Spawning {spawnCount} unique pending cards (total pending: {pending.Count})");
for (int i = 0; i < spawnCount; i++) for (int i = 0; i < spawnCount; i++)
{ {
@@ -446,14 +343,14 @@ namespace UI.CardSystem
// Guard: Don't spawn cards with zero copies // Guard: Don't spawn cards with zero copies
if (cardData.CopiesOwned <= 0) if (cardData.CopiesOwned <= 0)
{ {
Logging.Warning($"[AlbumViewPage] Skipping spawn of card '{cardData.Name}' with {cardData.CopiesOwned} copies"); Debug.LogWarning($"[AlbumViewPage] Skipping spawn of card '{cardData.Name}' with {cardData.CopiesOwned} copies");
return; return;
} }
DraggableSlot slot = FindSlotByIndex(slotIndex); DraggableSlot slot = FindSlotByIndex(slotIndex);
if (slot == null) if (slot == null)
{ {
Logging.Warning($"[AlbumViewPage] Could not find slot with SlotIndex {slotIndex}"); Debug.LogWarning($"[AlbumViewPage] Could not find slot with SlotIndex {slotIndex}");
return; return;
} }
@@ -480,11 +377,11 @@ namespace UI.CardSystem
// Track it // Track it
_activeCards.Add(cardPlacement); _activeCards.Add(cardPlacement);
Logging.Debug($"[AlbumViewPage] Spawned card '{cardData.Name}' (CopiesOwned: {cardData.CopiesOwned}) in slot {slotIndex}"); Debug.Log($"[AlbumViewPage] Spawned card '{cardData.Name}' (CopiesOwned: {cardData.CopiesOwned}) in slot {slotIndex}");
} }
else else
{ {
Logging.Warning($"[AlbumViewPage] Spawned card has no AlbumCardDraggable component!"); Debug.LogWarning($"[AlbumViewPage] Spawned card has no AlbumCardDraggable component!");
Destroy(cardObj); Destroy(cardObj);
} }
} }
@@ -498,7 +395,7 @@ namespace UI.CardSystem
// Guard: Don't spawn cards with zero copies // Guard: Don't spawn cards with zero copies
if (card.CopiesOwned <= 0) if (card.CopiesOwned <= 0)
{ {
Logging.Warning($"[AlbumViewPage] Ignoring pending card '{card.Name}' with {card.CopiesOwned} copies"); Debug.LogWarning($"[AlbumViewPage] Ignoring pending card '{card.Name}' with {card.CopiesOwned} copies");
return; return;
} }
@@ -509,7 +406,7 @@ namespace UI.CardSystem
if (alreadySpawned) if (alreadySpawned)
{ {
Logging.Debug($"[AlbumViewPage] Card '{card.Name}' already spawned, skipping duplicate spawn"); Debug.Log($"[AlbumViewPage] Card '{card.Name}' already spawned, skipping duplicate spawn");
return; // Don't spawn duplicates return; // Don't spawn duplicates
} }
@@ -526,13 +423,13 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnCardRevealed(AlbumCardPlacementDraggable cardPlacement, CardData cardData) private void OnCardRevealed(AlbumCardPlacementDraggable cardPlacement, CardData cardData)
{ {
Logging.Debug($"[AlbumViewPage] Card revealed: {cardData.Name} (Zone: {cardData.Zone}, CopiesOwned: {cardData.CopiesOwned})"); Debug.Log($"[AlbumViewPage] Card revealed: {cardData.Name} (Zone: {cardData.Zone}, CopiesOwned: {cardData.CopiesOwned})");
// IMMEDIATELY move card from pending to inventory upon reveal // IMMEDIATELY move card from pending to inventory upon reveal
if (CardSystemManager.Instance != null) if (CardSystemManager.Instance != null)
{ {
CardSystemManager.Instance.MarkCardAsPlaced(cardData); CardSystemManager.Instance.MarkCardAsPlaced(cardData);
Logging.Debug($"[AlbumViewPage] Moved card '{cardData.Name}' from pending to inventory on reveal"); Debug.Log($"[AlbumViewPage] Moved card '{cardData.Name}' from pending to inventory on reveal");
} }
// Remove this card from active cards list // Remove this card from active cards list
@@ -544,12 +441,12 @@ namespace UI.CardSystem
if (currentZone != cardData.Zone) if (currentZone != cardData.Zone)
{ {
// Card is from a different zone - navigate to its zone // Card is from a different zone - navigate to its zone
Logging.Debug($"[AlbumViewPage] Card zone ({cardData.Zone}) doesn't match current zone ({currentZone}). Navigating to card's zone..."); Debug.Log($"[AlbumViewPage] Card zone ({cardData.Zone}) doesn't match current zone ({currentZone}). Navigating to card's zone...");
NavigateToZone(cardData.Zone); NavigateToZone(cardData.Zone);
} }
else else
{ {
Logging.Debug($"[AlbumViewPage] Card zone ({cardData.Zone}) matches current zone - no navigation needed."); Debug.Log($"[AlbumViewPage] Card zone ({cardData.Zone}) matches current zone - no navigation needed.");
} }
// Shuffle remaining cards to front and spawn next unique card // Shuffle remaining cards to front and spawn next unique card
@@ -564,7 +461,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnCardPlacedInAlbum(AlbumCardPlacementDraggable cardPlacement, CardData cardData) private void OnCardPlacedInAlbum(AlbumCardPlacementDraggable cardPlacement, CardData cardData)
{ {
Logging.Debug($"[AlbumViewPage] Card placed in album slot: {cardData.Name}"); Debug.Log($"[AlbumViewPage] Card placed in album slot: {cardData.Name}");
// Unsubscribe from events (card is now static in album) // Unsubscribe from events (card is now static in album)
cardPlacement.OnCardRevealed -= OnCardRevealed; cardPlacement.OnCardRevealed -= OnCardRevealed;
@@ -648,9 +545,7 @@ namespace UI.CardSystem
public CardZone GetCurrentZone() public CardZone GetCurrentZone()
{ {
if (book == null || zoneTabs == null || zoneTabs.Length == 0) if (book == null || zoneTabs == null || zoneTabs.Length == 0)
{
return CardZone.AppleHills; // Default return CardZone.AppleHills; // Default
}
int currentPage = book.CurrentPaper; int currentPage = book.CurrentPaper;
@@ -662,8 +557,9 @@ namespace UI.CardSystem
return tab.Zone; return tab.Zone;
} }
} }
// Fallback to first zone // Fallback to first zone
return CardZone.NotApplicable; return zoneTabs[0].Zone;
} }
/// <summary> /// <summary>
@@ -671,11 +567,8 @@ namespace UI.CardSystem
/// </summary> /// </summary>
public BookTabButton GetTabForZone(CardZone zone) public BookTabButton GetTabForZone(CardZone zone)
{ {
if (zoneTabs == null) if (zoneTabs == null)
{
return null; return null;
}
foreach (var tab in zoneTabs) foreach (var tab in zoneTabs)
{ {
@@ -684,7 +577,6 @@ namespace UI.CardSystem
return tab; return tab;
} }
} }
return null; return null;
} }
@@ -751,7 +643,7 @@ namespace UI.CardSystem
{ {
if (card == null) return; if (card == null) return;
Logging.Debug($"[AlbumViewPage] OnCardEnlargeRequested called for card: {card.name}, current parent: {card.transform.parent.name}"); Debug.Log($"[AlbumViewPage] OnCardEnlargeRequested called for card: {card.name}, current parent: {card.transform.parent.name}");
// IMPORTANT: Call EnlargeCard FIRST to store original parent (the slot) // IMPORTANT: Call EnlargeCard FIRST to store original parent (the slot)
// BEFORE reparenting to the enlarged container // BEFORE reparenting to the enlarged container
@@ -761,7 +653,7 @@ namespace UI.CardSystem
if (cardEnlargedBackdrop != null) if (cardEnlargedBackdrop != null)
{ {
cardEnlargedBackdrop.SetActive(true); cardEnlargedBackdrop.SetActive(true);
Logging.Debug($"[AlbumViewPage] Backdrop shown"); Debug.Log($"[AlbumViewPage] Backdrop shown");
} }
// NOW reparent card to enlarged container (above backdrop) // NOW reparent card to enlarged container (above backdrop)
@@ -769,10 +661,10 @@ namespace UI.CardSystem
{ {
card.transform.SetParent(cardEnlargedContainer, true); card.transform.SetParent(cardEnlargedContainer, true);
card.transform.SetAsLastSibling(); // Ensure on top card.transform.SetAsLastSibling(); // Ensure on top
Logging.Debug($"[AlbumViewPage] Card reparented to enlarged container"); Debug.Log($"[AlbumViewPage] Card reparented to enlarged container");
} }
Logging.Debug($"[AlbumViewPage] Card enlarged: {card.GetCardData()?.Name}"); Debug.Log($"[AlbumViewPage] Card enlarged: {card.GetCardData()?.Name}");
} }
/// <summary> /// <summary>
@@ -800,7 +692,7 @@ namespace UI.CardSystem
card.transform.localRotation = card.GetOriginalLocalRotation(); card.transform.localRotation = card.GetOriginalLocalRotation();
} }
Logging.Debug($"[AlbumViewPage] Card shrunk: {card.GetCardData()?.Name}"); Debug.Log($"[AlbumViewPage] Card shrunk: {card.GetCardData()?.Name}");
} }
/// <summary> /// <summary>
@@ -811,7 +703,7 @@ namespace UI.CardSystem
if (previewCardTransform == null) if (previewCardTransform == null)
return; return;
Logging.Debug($"[AlbumViewPage] ShowSlotPreview called for slot: {slot.name}"); Debug.Log($"[AlbumViewPage] ShowSlotPreview called for slot: {slot.name}");
// Show backdrop // Show backdrop
if (cardEnlargedBackdrop != null) if (cardEnlargedBackdrop != null)
@@ -835,7 +727,7 @@ namespace UI.CardSystem
if (previewCardTransform == null) if (previewCardTransform == null)
return; return;
Logging.Debug($"[AlbumViewPage] HideSlotPreview called for slot: {slot.name}"); Debug.Log($"[AlbumViewPage] HideSlotPreview called for slot: {slot.name}");
// Hide backdrop // Hide backdrop
if (cardEnlargedBackdrop != null) if (cardEnlargedBackdrop != null)

View File

@@ -1,7 +1,6 @@
using System; using System;
using AppleHills.Data.CardSystem; using AppleHills.Data.CardSystem;
using BookCurlPro; using BookCurlPro;
using Core;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using Tween = Pixelplacement.Tween; using Tween = Pixelplacement.Tween;
@@ -70,7 +69,7 @@ namespace UI.CardSystem
{ {
if (book == null) if (book == null)
{ {
Logging.Warning($"[BookTabButton] No BookPro reference assigned on {gameObject.name}"); Debug.LogWarning($"[BookTabButton] No BookPro reference assigned on {gameObject.name}");
return; return;
} }

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AppleHills.Data.CardSystem; using AppleHills.Data.CardSystem;
using Core;
using Data.CardSystem; using Data.CardSystem;
using Pixelplacement; using Pixelplacement;
using UI.Core; using UI.Core;
@@ -69,7 +68,7 @@ namespace UI.CardSystem
} }
else else
{ {
Logging.Warning("[BoosterOpeningPage] albumIcon does not have a Button component!"); Debug.LogWarning("[BoosterOpeningPage] albumIcon does not have a Button component!");
} }
} }
@@ -112,20 +111,13 @@ namespace UI.CardSystem
if (UIPageController.Instance != null) if (UIPageController.Instance != null)
{ {
UIPageController.Instance.PopPage(); UIPageController.Instance.PopPage();
Logging.Debug("[BoosterOpeningPage] Dismiss button clicked, popping page from stack"); Debug.Log("[BoosterOpeningPage] Dismiss button clicked, popping page from stack");
} }
} }
public override void TransitionIn() public override void TransitionIn()
{ {
base.TransitionIn(); base.TransitionIn();
// Ensure album icon is visible when page opens
if (albumIcon != null)
{
albumIcon.SetActive(true);
}
InitializeBoosterDisplay(); InitializeBoosterDisplay();
} }
@@ -140,17 +132,17 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void InitializeBoosterDisplay() private void InitializeBoosterDisplay()
{ {
Logging.Debug($"[BoosterOpeningPage] InitializeBoosterDisplay called with {_availableBoosterCount} boosters available"); Debug.Log($"[BoosterOpeningPage] InitializeBoosterDisplay called with {_availableBoosterCount} boosters available");
if (boosterPackPrefab == null) if (boosterPackPrefab == null)
{ {
Logging.Warning("BoosterOpeningPage: No booster pack prefab assigned!"); Debug.LogWarning("BoosterOpeningPage: No booster pack prefab assigned!");
return; return;
} }
if (bottomRightSlots == null || bottomRightSlots.SlotCount == 0) if (bottomRightSlots == null || bottomRightSlots.SlotCount == 0)
{ {
Logging.Warning("BoosterOpeningPage: No slots available!"); Debug.LogWarning("BoosterOpeningPage: No slots available!");
return; return;
} }
@@ -160,7 +152,7 @@ namespace UI.CardSystem
// Calculate how many boosters to show (max 3, or available count, whichever is lower) // Calculate how many boosters to show (max 3, or available count, whichever is lower)
int visibleCount = Mathf.Min(_availableBoosterCount, MAX_VISIBLE_BOOSTERS); int visibleCount = Mathf.Min(_availableBoosterCount, MAX_VISIBLE_BOOSTERS);
Logging.Debug($"[BoosterOpeningPage] Will spawn {visibleCount} boosters"); Debug.Log($"[BoosterOpeningPage] Will spawn {visibleCount} boosters");
// Spawn boosters and assign to slots // Spawn boosters and assign to slots
for (int i = 0; i < visibleCount; i++) for (int i = 0; i < visibleCount; i++)
@@ -173,11 +165,11 @@ namespace UI.CardSystem
{ {
centerOpeningSlot.OnOccupied += OnBoosterPlacedInCenter; centerOpeningSlot.OnOccupied += OnBoosterPlacedInCenter;
centerOpeningSlot.OnVacated += OnBoosterRemovedFromCenter; centerOpeningSlot.OnVacated += OnBoosterRemovedFromCenter;
Logging.Debug($"[BoosterOpeningPage] Subscribed to center slot events"); Debug.Log($"[BoosterOpeningPage] Subscribed to center slot events");
} }
else else
{ {
Logging.Warning("[BoosterOpeningPage] centerOpeningSlot is null!"); Debug.LogWarning("[BoosterOpeningPage] centerOpeningSlot is null!");
} }
} }
@@ -189,7 +181,7 @@ namespace UI.CardSystem
DraggableSlot slot = FindSlotByIndex(slotIndex); DraggableSlot slot = FindSlotByIndex(slotIndex);
if (slot == null) if (slot == null)
{ {
Logging.Warning($"[BoosterOpeningPage] Could not find slot with SlotIndex {slotIndex}!"); Debug.LogWarning($"[BoosterOpeningPage] Could not find slot with SlotIndex {slotIndex}!");
return; return;
} }
@@ -212,11 +204,11 @@ namespace UI.CardSystem
// Track it // Track it
_activeBoostersInSlots.Add(booster); _activeBoostersInSlots.Add(booster);
Logging.Debug($"[BoosterOpeningPage] Spawned booster in slot with SlotIndex {slotIndex}"); Debug.Log($"[BoosterOpeningPage] Spawned booster in slot with SlotIndex {slotIndex}");
} }
else else
{ {
Logging.Warning($"[BoosterOpeningPage] Spawned booster has no BoosterPackDraggable component!"); Debug.LogWarning($"[BoosterOpeningPage] Spawned booster has no BoosterPackDraggable component!");
Destroy(boosterObj); Destroy(boosterObj);
} }
} }
@@ -252,7 +244,7 @@ namespace UI.CardSystem
booster.CurrentSlot.Vacate(); booster.CurrentSlot.Vacate();
} }
Logging.Debug($"[BoosterOpeningPage] Removed booster from slot {slotIndex}"); Debug.Log($"[BoosterOpeningPage] Removed booster from slot {slotIndex}");
} }
_activeBoostersInSlots.RemoveAt(slotIndex); _activeBoostersInSlots.RemoveAt(slotIndex);
@@ -272,7 +264,7 @@ namespace UI.CardSystem
RemoveBoosterFromSlot(lastIndex); RemoveBoosterFromSlot(lastIndex);
} }
Logging.Debug($"[BoosterOpeningPage] Updated visible boosters: {_activeBoostersInSlots.Count}/{targetCount}"); Debug.Log($"[BoosterOpeningPage] Updated visible boosters: {_activeBoostersInSlots.Count}/{targetCount}");
} }
/// <summary> /// <summary>
@@ -282,7 +274,7 @@ namespace UI.CardSystem
{ {
if (_activeBoostersInSlots.Count == 0) return; if (_activeBoostersInSlots.Count == 0) return;
Logging.Debug($"[BoosterOpeningPage] Shuffling {_activeBoostersInSlots.Count} boosters to front slots"); Debug.Log($"[BoosterOpeningPage] Shuffling {_activeBoostersInSlots.Count} boosters to front slots");
// Unassign all boosters from their current slots // Unassign all boosters from their current slots
foreach (var booster in _activeBoostersInSlots) foreach (var booster in _activeBoostersInSlots)
@@ -302,12 +294,12 @@ namespace UI.CardSystem
if (targetSlot != null) if (targetSlot != null)
{ {
Logging.Debug($"[BoosterOpeningPage] Assigning booster to slot with SlotIndex {i} {targetSlot.name}"); Debug.Log($"[BoosterOpeningPage] Assigning booster to slot with SlotIndex {i} {targetSlot.name}");
booster.AssignToSlot(targetSlot, true); // Animate the move booster.AssignToSlot(targetSlot, true); // Animate the move
} }
else else
{ {
Logging.Warning($"[BoosterOpeningPage] Could not find slot with SlotIndex {i} {targetSlot.name}"); Debug.LogWarning($"[BoosterOpeningPage] Could not find slot with SlotIndex {i} {targetSlot.name}");
} }
} }
} }
@@ -352,7 +344,7 @@ namespace UI.CardSystem
if (slot != null && !slot.IsOccupied) if (slot != null && !slot.IsOccupied)
{ {
SpawnBoosterInSlot(i); SpawnBoosterInSlot(i);
Logging.Debug($"[BoosterOpeningPage] Spawned new booster in slot with SlotIndex {i}"); Debug.Log($"[BoosterOpeningPage] Spawned new booster in slot with SlotIndex {i}");
break; break;
} }
} }
@@ -371,20 +363,13 @@ namespace UI.CardSystem
// Remove from active slots list // Remove from active slots list
_activeBoostersInSlots.Remove(booster); _activeBoostersInSlots.Remove(booster);
// Hide album icon when booster is placed in center
if (albumIcon != null)
{
albumIcon.SetActive(false);
Logging.Debug($"[BoosterOpeningPage] Album icon hidden");
}
// Lock the slot so it can't be dragged out // Lock the slot so it can't be dragged out
Logging.Debug($"[BoosterOpeningPage] Locking center slot. IsLocked before: {centerOpeningSlot.IsLocked}"); Debug.Log($"[BoosterOpeningPage] Locking center slot. IsLocked before: {centerOpeningSlot.IsLocked}");
centerOpeningSlot.SetLocked(true); centerOpeningSlot.SetLocked(true);
Logging.Debug($"[BoosterOpeningPage] IsLocked after: {centerOpeningSlot.IsLocked}"); Debug.Log($"[BoosterOpeningPage] IsLocked after: {centerOpeningSlot.IsLocked}");
// Configure booster for opening (disables drag, enables tapping, resets tap count) // Configure booster for opening (disables drag, enables tapping, resets tap count)
Logging.Debug($"[BoosterOpeningPage] Calling SetInOpeningSlot(true) on booster"); Debug.Log($"[BoosterOpeningPage] Calling SetInOpeningSlot(true) on booster");
booster.SetInOpeningSlot(true); booster.SetInOpeningSlot(true);
// Subscribe to tap events for visual feedback // Subscribe to tap events for visual feedback
@@ -399,7 +384,7 @@ namespace UI.CardSystem
// Shuffle remaining boosters to occupy the first slots // Shuffle remaining boosters to occupy the first slots
ShuffleBoostersToFront(); ShuffleBoostersToFront();
Logging.Debug($"[BoosterOpeningPage] Booster placed in center, ready for taps. Active boosters in slots: {_activeBoostersInSlots.Count}"); Debug.Log($"[BoosterOpeningPage] Booster placed in center, ready for taps. Active boosters in slots: {_activeBoostersInSlots.Count}");
} }
/// <summary> /// <summary>
@@ -418,12 +403,12 @@ namespace UI.CardSystem
} }
_currentBoosterInCenter = null; _currentBoosterInCenter = null;
Logging.Debug($"[BoosterOpeningPage] Booster removed from center"); Debug.Log($"[BoosterOpeningPage] Booster removed from center");
} }
private void OnBoosterTapped(BoosterPackDraggable booster, int currentTaps, int maxTaps) private void OnBoosterTapped(BoosterPackDraggable booster, int currentTaps, int maxTaps)
{ {
Logging.Debug($"[BoosterOpeningPage] Booster tapped: {currentTaps}/{maxTaps}"); Debug.Log($"[BoosterOpeningPage] Booster tapped: {currentTaps}/{maxTaps}");
// Fire Cinemachine impulse with random velocity (excluding Z) // Fire Cinemachine impulse with random velocity (excluding Z)
if (impulseSource != null) if (impulseSource != null)
@@ -448,7 +433,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnBoosterOpened(BoosterPackDraggable booster) private void OnBoosterOpened(BoosterPackDraggable booster)
{ {
Logging.Debug($"[BoosterOpeningPage] Booster opened, playing particle effect"); Debug.Log($"[BoosterOpeningPage] Booster opened, playing particle effect");
// Reset and play particle system // Reset and play particle system
if (openingParticleSystem != null) if (openingParticleSystem != null)
@@ -486,7 +471,7 @@ namespace UI.CardSystem
{ {
if (_isProcessingOpening) return; if (_isProcessingOpening) return;
Logging.Debug($"[BoosterOpeningPage] Booster ready to open!"); Debug.Log($"[BoosterOpeningPage] Booster ready to open!");
// Trigger the actual opening sequence // Trigger the actual opening sequence
booster.TriggerOpen(); booster.TriggerOpen();
@@ -529,7 +514,7 @@ namespace UI.CardSystem
// WaitForCardReveals already includes: 0.5s wait + (cardCount * 0.5s stagger) + 0.5s animation + 0.5s final // WaitForCardReveals already includes: 0.5s wait + (cardCount * 0.5s stagger) + 0.5s animation + 0.5s final
// Total is: 1.5s + (cardCount * 0.5s) // Total is: 1.5s + (cardCount * 0.5s)
// For 5 cards that's 4 seconds total, which should be enough // For 5 cards that's 4 seconds total, which should be enough
Logging.Debug("[BoosterOpeningPage] Last booster opened, auto-transitioning to album main page"); Debug.Log("[BoosterOpeningPage] Last booster opened, auto-transitioning to album main page");
if (UIPageController.Instance != null) if (UIPageController.Instance != null)
{ {
UIPageController.Instance.PopPage(); UIPageController.Instance.PopPage();
@@ -576,7 +561,7 @@ namespace UI.CardSystem
{ {
if (flippableCardPrefab == null || cardDisplayContainer == null) if (flippableCardPrefab == null || cardDisplayContainer == null)
{ {
Logging.Warning("BoosterOpeningPage: Missing card prefab or container!"); Debug.LogWarning("BoosterOpeningPage: Missing card prefab or container!");
return; return;
} }
@@ -620,7 +605,7 @@ namespace UI.CardSystem
} }
else else
{ {
Logging.Warning($"[BoosterOpeningPage] FlippableCard component not found on card {i}!"); Debug.LogWarning($"[BoosterOpeningPage] FlippableCard component not found on card {i}!");
} }
_currentRevealedCards.Add(cardObj); _currentRevealedCards.Add(cardObj);
@@ -636,7 +621,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnCardFlipStarted(FlippableCard flippingCard) private void OnCardFlipStarted(FlippableCard flippingCard)
{ {
Logging.Debug($"[BoosterOpeningPage] Card flip started, disabling all other cards."); Debug.Log($"[BoosterOpeningPage] Card flip started, disabling all other cards.");
// Disable ALL cards immediately to prevent multi-flip // Disable ALL cards immediately to prevent multi-flip
foreach (GameObject cardObj in _currentRevealedCards) foreach (GameObject cardObj in _currentRevealedCards)
@@ -654,14 +639,14 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnCardRevealed(int cardIndex) private void OnCardRevealed(int cardIndex)
{ {
Logging.Debug($"[BoosterOpeningPage] Card {cardIndex} revealed!"); Debug.Log($"[BoosterOpeningPage] Card {cardIndex} revealed!");
_revealedCardCount++; _revealedCardCount++;
// Get the flippable card and card data // Get the flippable card and card data
FlippableCard flippableCard = _currentRevealedCards[cardIndex].GetComponent<FlippableCard>(); FlippableCard flippableCard = _currentRevealedCards[cardIndex].GetComponent<FlippableCard>();
if (flippableCard == null) if (flippableCard == null)
{ {
Logging.Warning($"[BoosterOpeningPage] FlippableCard not found for card {cardIndex}!"); Debug.LogWarning($"[BoosterOpeningPage] FlippableCard not found for card {cardIndex}!");
return; return;
} }
@@ -672,7 +657,7 @@ namespace UI.CardSystem
if (isNew) if (isNew)
{ {
Logging.Debug($"[BoosterOpeningPage] Card '{cardData.Name}' is NEW!"); Debug.Log($"[BoosterOpeningPage] Card '{cardData.Name}' is NEW!");
flippableCard.ShowAsNew(); flippableCard.ShowAsNew();
} }
else else
@@ -680,7 +665,7 @@ namespace UI.CardSystem
// Check if card is already Legendary - if so, skip progress bar and auto-progress // Check if card is already Legendary - if so, skip progress bar and auto-progress
if (existingCard.Rarity == AppleHills.Data.CardSystem.CardRarity.Legendary) if (existingCard.Rarity == AppleHills.Data.CardSystem.CardRarity.Legendary)
{ {
Logging.Debug($"[BoosterOpeningPage] Card '{cardData.Name}' is LEGENDARY - auto-progressing!"); Debug.Log($"[BoosterOpeningPage] Card '{cardData.Name}' is LEGENDARY - auto-progressing!");
// Add to inventory immediately and move to next card // Add to inventory immediately and move to next card
Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(cardData); Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(cardData);
_cardsCompletedInteraction++; _cardsCompletedInteraction++;
@@ -690,14 +675,14 @@ namespace UI.CardSystem
} }
int ownedCount = existingCard.CopiesOwned; int ownedCount = existingCard.CopiesOwned;
Logging.Debug($"[BoosterOpeningPage] Card '{cardData.Name}' is a REPEAT! Owned: {ownedCount}"); Debug.Log($"[BoosterOpeningPage] Card '{cardData.Name}' is a REPEAT! Owned: {ownedCount}");
// Check if this card will trigger an upgrade (ownedCount + 1 >= threshold) // Check if this card will trigger an upgrade (ownedCount + 1 >= threshold)
bool willUpgrade = (ownedCount + 1) >= flippableCard.CardsToUpgrade && existingCard.Rarity < AppleHills.Data.CardSystem.CardRarity.Legendary; bool willUpgrade = (ownedCount + 1) >= flippableCard.CardsToUpgrade && existingCard.Rarity < AppleHills.Data.CardSystem.CardRarity.Legendary;
if (willUpgrade) if (willUpgrade)
{ {
Logging.Debug($"[BoosterOpeningPage] This card will trigger upgrade! ({ownedCount + 1}/{flippableCard.CardsToUpgrade})"); Debug.Log($"[BoosterOpeningPage] This card will trigger upgrade! ({ownedCount + 1}/{flippableCard.CardsToUpgrade})");
// Show as repeat - progress bar will fill and auto-trigger upgrade // Show as repeat - progress bar will fill and auto-trigger upgrade
flippableCard.ShowAsRepeatWithUpgrade(ownedCount, existingCard); flippableCard.ShowAsRepeatWithUpgrade(ownedCount, existingCard);
} }
@@ -720,7 +705,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnCardCompletedInteraction(FlippableCard card, int cardIndex) private void OnCardCompletedInteraction(FlippableCard card, int cardIndex)
{ {
Logging.Debug($"[BoosterOpeningPage] Card {cardIndex} interaction complete!"); Debug.Log($"[BoosterOpeningPage] Card {cardIndex} interaction complete!");
// Add card to inventory NOW (after player saw it) // Add card to inventory NOW (after player saw it)
Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(card.CardData); Data.CardSystem.CardSystemManager.Instance.AddCardToInventoryDelayed(card.CardData);
@@ -737,7 +722,7 @@ namespace UI.CardSystem
// Re-enable all unrevealed cards (they can be flipped now) // Re-enable all unrevealed cards (they can be flipped now)
EnableUnrevealedCards(); EnableUnrevealedCards();
Logging.Debug($"[BoosterOpeningPage] Cards completed interaction: {_cardsCompletedInteraction}/{_currentCardData.Length}"); Debug.Log($"[BoosterOpeningPage] Cards completed interaction: {_cardsCompletedInteraction}/{_currentCardData.Length}");
} }
/// <summary> /// <summary>
@@ -758,7 +743,7 @@ namespace UI.CardSystem
} }
} }
Logging.Debug($"[BoosterOpeningPage] Set active card. Only one card is now clickable."); Debug.Log($"[BoosterOpeningPage] Set active card. Only one card is now clickable.");
} }
/// <summary> /// <summary>
@@ -775,7 +760,7 @@ namespace UI.CardSystem
} }
} }
Logging.Debug($"[BoosterOpeningPage] Re-enabled unrevealed cards for flipping."); Debug.Log($"[BoosterOpeningPage] Re-enabled unrevealed cards for flipping.");
} }
/// <summary> /// <summary>
@@ -783,7 +768,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void OnCardClickedWhileInactive(FlippableCard inactiveCard) private void OnCardClickedWhileInactive(FlippableCard inactiveCard)
{ {
Logging.Debug($"[BoosterOpeningPage] Inactive card clicked, jiggling active card."); Debug.Log($"[BoosterOpeningPage] Inactive card clicked, jiggling active card.");
if (_currentActiveCard != null) if (_currentActiveCard != null)
{ {
@@ -802,7 +787,7 @@ namespace UI.CardSystem
yield return null; yield return null;
} }
Logging.Debug($"[BoosterOpeningPage] All cards revealed! Waiting for interactions..."); Debug.Log($"[BoosterOpeningPage] All cards revealed! Waiting for interactions...");
// Wait until all cards have completed their new/repeat interaction // Wait until all cards have completed their new/repeat interaction
while (_cardsCompletedInteraction < _currentCardData.Length) while (_cardsCompletedInteraction < _currentCardData.Length)
@@ -810,18 +795,11 @@ namespace UI.CardSystem
yield return null; yield return null;
} }
Logging.Debug($"[BoosterOpeningPage] All interactions complete! Animating cards to album..."); Debug.Log($"[BoosterOpeningPage] All interactions complete! Animating cards to album...");
// All cards revealed and interacted with, wait a moment // All cards revealed and interacted with, wait a moment
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
// Show album icon before cards start tweening to it
if (albumIcon != null)
{
albumIcon.SetActive(true);
Logging.Debug($"[BoosterOpeningPage] Album icon shown for card tween target");
}
// Animate cards to album icon (or center if no icon assigned) with staggered delays // Animate cards to album icon (or center if no icon assigned) with staggered delays
Vector3 targetPosition = albumIcon != null ? albumIcon.transform.position : Vector3.zero; Vector3 targetPosition = albumIcon != null ? albumIcon.transform.position : Vector3.zero;
@@ -850,8 +828,6 @@ namespace UI.CardSystem
_currentRevealedCards.Clear(); _currentRevealedCards.Clear();
yield return new WaitForSeconds(totalAnimationTime); yield return new WaitForSeconds(totalAnimationTime);
// Album icon stays visible for next booster (will be hidden when next booster is placed)
} }
/// <summary> /// <summary>

View File

@@ -1,5 +1,4 @@
using System.Collections; using System.Collections;
using Core;
using Data.CardSystem; using Data.CardSystem;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
@@ -59,7 +58,7 @@ namespace UI.CardSystem
{ {
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
{ {
Logging.Warning("[BoosterPackGiver] Duplicate instance detected. Destroying this component."); Debug.LogWarning("[BoosterPackGiver] Duplicate instance detected. Destroying this component.");
Destroy(this); Destroy(this);
yield break; yield break;
} }

View File

@@ -1,5 +1,4 @@
using Core; using UI.Core;
using UI.Core;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@@ -47,7 +46,7 @@ namespace UI.CardSystem
openAlbumButton.onClick.RemoveListener(OnOpenAlbumClicked); openAlbumButton.onClick.RemoveListener(OnOpenAlbumClicked);
} }
Logging.Debug("ALBUM: CardAlbumDestroyed"); Debug.Log("ALBUM: CardAlbumDestroyed");
} }
private void OnOpenAlbumClicked() private void OnOpenAlbumClicked()

View File

@@ -335,7 +335,7 @@ namespace UI.CardSystem
{ {
if (editorCardDefinition == null) if (editorCardDefinition == null)
{ {
Debug.LogWarning("[CardDisplay] No Card Definition assigned in Editor Tools."); UnityEngine.Debug.LogWarning("[CardDisplay] No Card Definition assigned in Editor Tools.");
return; return;
} }

View File

@@ -1,7 +1,6 @@
using System; using System;
using System.Collections; using System.Collections;
using AppleHills.Data.CardSystem; using AppleHills.Data.CardSystem;
using Core;
using Data.CardSystem; using Data.CardSystem;
using Pixelplacement; using Pixelplacement;
using UI.DragAndDrop.Core; using UI.DragAndDrop.Core;
@@ -64,15 +63,15 @@ namespace UI.CardSystem
/// </summary> /// </summary>
public void RevealCard() public void RevealCard()
{ {
if (_isRevealed) if (_isRevealed) return;
{
return;
}
_isRevealed = true; _isRevealed = true;
if (flippableCard != null) if (flippableCard != null)
{ {
flippableCard.FlipToReveal(); flippableCard.FlipToReveal();
} }
OnCardRevealed?.Invoke(this, _cardData); OnCardRevealed?.Invoke(this, _cardData);
} }
@@ -83,7 +82,7 @@ namespace UI.CardSystem
{ {
if (_cardData == null) if (_cardData == null)
{ {
Logging.Warning("[AlbumCardPlacementDraggable] Cannot snap to slot - no card data assigned."); Debug.LogWarning("[AlbumCardPlacementDraggable] Cannot snap to slot - no card data assigned.");
return; return;
} }
@@ -118,7 +117,7 @@ namespace UI.CardSystem
TweenExtractedCardToSlot(extractedCard, () => TweenExtractedCardToSlot(extractedCard, () =>
{ {
// After animation completes // After animation completes
Logging.Debug($"[AlbumCardPlacementDraggable] Card placement animation complete for {_cardData.Name}"); Debug.Log($"[AlbumCardPlacementDraggable] Card placement animation complete for {_cardData.Name}");
// Notify that card was placed // Notify that card was placed
OnCardPlacedInAlbum?.Invoke(this, _cardData); OnCardPlacedInAlbum?.Invoke(this, _cardData);
@@ -129,13 +128,13 @@ namespace UI.CardSystem
} }
else else
{ {
Logging.Warning("[AlbumCardPlacementDraggable] Failed to extract AlbumCard from wrapper!"); Debug.LogWarning("[AlbumCardPlacementDraggable] Failed to extract AlbumCard from wrapper!");
} }
} }
} }
else else
{ {
Logging.Warning($"[AlbumCardPlacementDraggable] Could not find matching slot for card '{_cardData.Name}' (Zone: {_cardData.Zone}, Index: {_cardData.CollectionIndex})"); Debug.LogWarning($"[AlbumCardPlacementDraggable] Could not find matching slot for card '{_cardData.Name}' (Zone: {_cardData.Zone}, Index: {_cardData.CollectionIndex})");
} }
} }
@@ -163,7 +162,7 @@ namespace UI.CardSystem
Tween.LocalRotation(cardTransform, Quaternion.identity, snapDuration, 0f, Tween.EaseOutBack, Tween.LocalRotation(cardTransform, Quaternion.identity, snapDuration, 0f, Tween.EaseOutBack,
completeCallback: () => completeCallback: () =>
{ {
Logging.Debug($"[AlbumCardPlacementDraggable] Tween complete for extracted card {card.name}, final height: {cardRect.sizeDelta.y}"); Debug.Log($"[AlbumCardPlacementDraggable] Tween complete for extracted card {card.name}, final height: {cardRect.sizeDelta.y}");
onComplete?.Invoke(); onComplete?.Invoke();
}); });
} }
@@ -192,6 +191,9 @@ namespace UI.CardSystem
protected override void OnPointerUpHook(bool longPress) protected override void OnPointerUpHook(bool longPress)
{ {
base.OnPointerUpHook(longPress); base.OnPointerUpHook(longPress);
Debug.Log($"[CLICK-TRACE-PLACEMENT] OnPointerUpHook on {name}, _wasDragged={_wasDragged}, _isRevealed={_isRevealed}, _waitingForPlacementTap={_waitingForPlacementTap}, longPress={longPress}");
_isHolding = false; _isHolding = false;
// Cancel hold timer if running // Cancel hold timer if running
@@ -200,35 +202,40 @@ namespace UI.CardSystem
StopCoroutine(_holdRevealCoroutine); StopCoroutine(_holdRevealCoroutine);
_holdRevealCoroutine = null; _holdRevealCoroutine = null;
} }
else
{
}
// Handle tap (not dragged) // Handle tap (not dragged)
if (!_wasDragged) if (!_wasDragged)
{ {
if (!_isRevealed) if (!_isRevealed)
{ {
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - First tap, revealing card");
// First tap: reveal the card // First tap: reveal the card
RevealCard(); RevealCard();
_waitingForPlacementTap = true; _waitingForPlacementTap = true;
} }
else if (_waitingForPlacementTap) else if (_waitingForPlacementTap)
{ {
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Second tap, snapping to slot");
// Second tap: snap to slot // Second tap: snap to slot
_waitingForPlacementTap = false; _waitingForPlacementTap = false;
SnapToAlbumSlot(); SnapToAlbumSlot();
} }
else else
{ {
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Tap after reveal but not waiting for placement tap");
} }
} }
else if (_isDragRevealing) else if (_isDragRevealing)
{ {
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Was drag-revealed, auto-snapping");
// Was drag-revealed, auto-snap on release // Was drag-revealed, auto-snap on release
_isDragRevealing = false; _isDragRevealing = false;
SnapToAlbumSlot(); SnapToAlbumSlot();
} }
else
{
Debug.Log($"[CLICK-TRACE-PLACEMENT] {name} - Was dragged but no special handling");
}
} }
/// <summary> /// <summary>
@@ -243,6 +250,7 @@ namespace UI.CardSystem
{ {
RevealCard(); RevealCard();
_isDragRevealing = true; _isDragRevealing = true;
Debug.Log("[AlbumCardDraggable] Card revealed via hold");
} }
_holdRevealCoroutine = null; _holdRevealCoroutine = null;

View File

@@ -1,5 +1,4 @@
using AppleHills.Data.CardSystem; using AppleHills.Data.CardSystem;
using Core;
using Data.CardSystem; using Data.CardSystem;
using UI.DragAndDrop.Core; using UI.DragAndDrop.Core;
using UnityEngine; using UnityEngine;
@@ -134,7 +133,7 @@ namespace UI.CardSystem
// Keep preview hidden - it'll show when user taps to enlarge // Keep preview hidden - it'll show when user taps to enlarge
previewCardDisplay.gameObject.SetActive(false); previewCardDisplay.gameObject.SetActive(false);
Logging.Debug($"[AlbumCardSlot] Setup preview card for {targetCardDefinition.Name} (hidden until tap)"); Debug.Log($"[AlbumCardSlot] Setup preview card for {targetCardDefinition.Name} (hidden until tap)");
} }
/// <summary> /// <summary>
@@ -153,7 +152,7 @@ namespace UI.CardSystem
// Guard: need prefab to spawn // Guard: need prefab to spawn
if (albumCardPrefab == null) if (albumCardPrefab == null)
{ {
Logging.Warning($"[AlbumCardSlot] No albumCardPrefab assigned for slot targeting {targetCardDefinition.name}"); Debug.LogWarning($"[AlbumCardSlot] No albumCardPrefab assigned for slot targeting {targetCardDefinition.name}");
return; return;
} }
@@ -214,11 +213,11 @@ namespace UI.CardSystem
albumPage.RegisterAlbumCard(albumCard); albumPage.RegisterAlbumCard(albumCard);
} }
Logging.Debug($"[AlbumCardSlot] Spawned owned card '{cardData.Name}' ({cardData.Rarity}) in slot"); Debug.Log($"[AlbumCardSlot] Spawned owned card '{cardData.Name}' ({cardData.Rarity}) in slot");
} }
else else
{ {
Logging.Warning($"[AlbumCardSlot] Spawned prefab has no AlbumCard component!"); Debug.LogWarning($"[AlbumCardSlot] Spawned prefab has no AlbumCard component!");
Destroy(cardObj); Destroy(cardObj);
} }
} }
@@ -236,30 +235,30 @@ namespace UI.CardSystem
/// </summary> /// </summary>
public void OnPointerClick(PointerEventData eventData) public void OnPointerClick(PointerEventData eventData)
{ {
Logging.Debug($"[CLICK-TRACE-SLOT] OnPointerClick on {name}, _isOccupiedPermanently={_isOccupiedPermanently}, _placedCard={((_placedCard != null) ? _placedCard.name : "NULL")}, _isPreviewShowing={_isPreviewShowing}, position={eventData.position}"); Debug.Log($"[CLICK-TRACE-SLOT] OnPointerClick on {name}, _isOccupiedPermanently={_isOccupiedPermanently}, _placedCard={((_placedCard != null) ? _placedCard.name : "NULL")}, _isPreviewShowing={_isPreviewShowing}, position={eventData.position}");
// Only handle clicks if slot is empty // Only handle clicks if slot is empty
if (_isOccupiedPermanently || _placedCard != null) if (_isOccupiedPermanently || _placedCard != null)
{ {
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Slot is occupied, ignoring"); Debug.Log($"[CLICK-TRACE-SLOT] {name} - Slot is occupied, ignoring");
return; return;
} }
// Only handle if we have a preview card setup // Only handle if we have a preview card setup
if (previewCardDisplay == null || targetCardDefinition == null) if (previewCardDisplay == null || targetCardDefinition == null)
{ {
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - No preview setup, ignoring"); Debug.Log($"[CLICK-TRACE-SLOT] {name} - No preview setup, ignoring");
return; return;
} }
if (_isPreviewShowing) if (_isPreviewShowing)
{ {
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Preview is showing, hiding it"); Debug.Log($"[CLICK-TRACE-SLOT] {name} - Preview is showing, hiding it");
HidePreview(); HidePreview();
} }
else else
{ {
Logging.Debug($"[CLICK-TRACE-SLOT] {name} - Preview is hidden, showing it"); Debug.Log($"[CLICK-TRACE-SLOT] {name} - Preview is hidden, showing it");
ShowPreview(); ShowPreview();
} }
} }
@@ -294,7 +293,7 @@ namespace UI.CardSystem
Pixelplacement.Tween.LocalScale(previewCardDisplay.transform, _previewOriginalScale * previewEnlargedScale, Pixelplacement.Tween.LocalScale(previewCardDisplay.transform, _previewOriginalScale * previewEnlargedScale,
previewScaleDuration, 0f, Pixelplacement.Tween.EaseOutBack); previewScaleDuration, 0f, Pixelplacement.Tween.EaseOutBack);
Logging.Debug($"[AlbumCardSlot] Showing preview for {targetCardDefinition.Name}"); Debug.Log($"[AlbumCardSlot] Showing preview for {targetCardDefinition.Name}");
} }
/// <summary> /// <summary>
@@ -341,11 +340,11 @@ namespace UI.CardSystem
// Hide the preview card after returning to slot // Hide the preview card after returning to slot
previewCardDisplay.gameObject.SetActive(false); previewCardDisplay.gameObject.SetActive(false);
Logging.Debug($"[AlbumCardSlot] Preview hidden and reset for {targetCardDefinition.Name}"); Debug.Log($"[AlbumCardSlot] Preview hidden and reset for {targetCardDefinition.Name}");
}); });
} }
Logging.Debug($"[AlbumCardSlot] Hiding preview for {targetCardDefinition.Name}"); Debug.Log($"[AlbumCardSlot] Hiding preview for {targetCardDefinition.Name}");
} }
/// <summary> /// <summary>
@@ -353,7 +352,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
public void DismissPreview() public void DismissPreview()
{ {
Logging.Debug($"[CLICK-TRACE-SLOT] DismissPreview called on {name}"); Debug.Log($"[CLICK-TRACE-SLOT] DismissPreview called on {name}");
HidePreview(); HidePreview();
} }

View File

@@ -1,5 +1,4 @@
using Core; using UI.DragAndDrop.Core;
using UI.DragAndDrop.Core;
using UnityEngine; using UnityEngine;
namespace UI.CardSystem.DragDrop namespace UI.CardSystem.DragDrop
@@ -128,10 +127,10 @@ namespace UI.CardSystem.DragDrop
/// </summary> /// </summary>
public void SetInOpeningSlot(bool inSlot) public void SetInOpeningSlot(bool inSlot)
{ {
Logging.Debug($"[BoosterPackDraggable] SetInOpeningSlot({inSlot}) called on {name}"); Debug.Log($"[BoosterPackDraggable] SetInOpeningSlot({inSlot}) called on {name}");
SetDraggingEnabled(!inSlot); // Disable dragging when in opening slot SetDraggingEnabled(!inSlot); // Disable dragging when in opening slot
Logging.Debug($"[BoosterPackDraggable] SetDraggingEnabled({!inSlot}) called"); Debug.Log($"[BoosterPackDraggable] SetDraggingEnabled({!inSlot}) called");
canTapToOpen = inSlot; // Enable tap-to-open when in opening slot canTapToOpen = inSlot; // Enable tap-to-open when in opening slot

View File

@@ -1,6 +1,5 @@
using System; using System;
using AppleHills.Data.CardSystem; using AppleHills.Data.CardSystem;
using Core;
using Pixelplacement; using Pixelplacement;
using Pixelplacement.TweenSystem; using Pixelplacement.TweenSystem;
using UnityEngine; using UnityEngine;
@@ -261,12 +260,12 @@ namespace UI.CardSystem
public void OnPointerClick(PointerEventData eventData) public void OnPointerClick(PointerEventData eventData)
{ {
Logging.Debug($"[CLICK-TRACE-FLIPPABLE] OnPointerClick on {name}, _isClickable={_isClickable}, _isWaitingForTap={_isWaitingForTap}, _isFlipped={_isFlipped}, position={eventData.position}"); Debug.Log($"[CLICK-TRACE-FLIPPABLE] OnPointerClick on {name}, _isClickable={_isClickable}, _isWaitingForTap={_isWaitingForTap}, _isFlipped={_isFlipped}, position={eventData.position}");
// If not clickable, notify and return // If not clickable, notify and return
if (!_isClickable) if (!_isClickable)
{ {
Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Not clickable, firing OnClickedWhileInactive"); Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Not clickable, firing OnClickedWhileInactive");
OnClickedWhileInactive?.Invoke(this); OnClickedWhileInactive?.Invoke(this);
return; return;
} }
@@ -274,7 +273,7 @@ namespace UI.CardSystem
// If waiting for tap after reveal, handle that // If waiting for tap after reveal, handle that
if (_isWaitingForTap) if (_isWaitingForTap)
{ {
Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Waiting for tap, dismissing enlarged state"); Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Waiting for tap, dismissing enlarged state");
OnCardTappedAfterReveal?.Invoke(this); OnCardTappedAfterReveal?.Invoke(this);
_isWaitingForTap = false; _isWaitingForTap = false;
return; return;
@@ -282,11 +281,11 @@ namespace UI.CardSystem
if (_isFlipped || _isFlipping) if (_isFlipped || _isFlipping)
{ {
Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Ignoring click (flipped={_isFlipped}, flipping={_isFlipping})"); Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Ignoring click (flipped={_isFlipped}, flipping={_isFlipping})");
return; return;
} }
Logging.Debug($"[CLICK-TRACE-FLIPPABLE] {name} - Processing click, starting flip"); Debug.Log($"[CLICK-TRACE-FLIPPABLE] {name} - Processing click, starting flip");
// Flip on click // Flip on click
FlipToReveal(); FlipToReveal();
} }
@@ -342,7 +341,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void TriggerUpgradeTransition(AppleHills.Data.CardSystem.CardData lowerRarityCard) private void TriggerUpgradeTransition(AppleHills.Data.CardSystem.CardData lowerRarityCard)
{ {
Logging.Debug($"[FlippableCard] Triggering upgrade transition from {lowerRarityCard.Rarity}!"); Debug.Log($"[FlippableCard] Triggering upgrade transition from {lowerRarityCard.Rarity}!");
AppleHills.Data.CardSystem.CardRarity oldRarity = lowerRarityCard.Rarity; AppleHills.Data.CardSystem.CardRarity oldRarity = lowerRarityCard.Rarity;
AppleHills.Data.CardSystem.CardRarity newRarity = oldRarity + 1; AppleHills.Data.CardSystem.CardRarity newRarity = oldRarity + 1;
@@ -430,7 +429,7 @@ namespace UI.CardSystem
if (newCardText != null) if (newCardText != null)
newCardText.SetActive(true); newCardText.SetActive(true);
Logging.Debug($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing as NEW."); Debug.Log($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing as NEW.");
// Card is already enlarged from the repeat display, so no need to enlarge again // Card is already enlarged from the repeat display, so no need to enlarge again
} }
@@ -458,7 +457,7 @@ namespace UI.CardSystem
TransitionToNewCardView(newRarity); TransitionToNewCardView(newRarity);
}); });
Logging.Debug($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing progress {ownedAtNewRarity}/5"); Debug.Log($"[FlippableCard] Card upgraded from {oldRarity} to {newRarity}! Showing progress {ownedAtNewRarity}/5");
} }
/// <summary> /// <summary>
@@ -466,7 +465,7 @@ namespace UI.CardSystem
/// </summary> /// </summary>
private void TransitionToNewCardView(AppleHills.Data.CardSystem.CardRarity newRarity) private void TransitionToNewCardView(AppleHills.Data.CardSystem.CardRarity newRarity)
{ {
Logging.Debug($"[FlippableCard] Transitioning to NEW CARD view at {newRarity} rarity"); Debug.Log($"[FlippableCard] Transitioning to NEW CARD view at {newRarity} rarity");
// Update the CardDisplay to show new rarity // Update the CardDisplay to show new rarity
if (cardDisplay != null && _cardData != null) if (cardDisplay != null && _cardData != null)
@@ -489,7 +488,7 @@ namespace UI.CardSystem
_isNew = true; _isNew = true;
_isWaitingForTap = true; _isWaitingForTap = true;
Logging.Debug($"[FlippableCard] Now showing as NEW CARD at {newRarity}, waiting for tap"); Debug.Log($"[FlippableCard] Now showing as NEW CARD at {newRarity}, waiting for tap");
} }
/// <summary> /// <summary>
@@ -539,7 +538,7 @@ namespace UI.CardSystem
// Check if we have the required number of elements (should match cardsToUpgrade) // Check if we have the required number of elements (should match cardsToUpgrade)
if (progressElements.Length < cardsToUpgrade) if (progressElements.Length < cardsToUpgrade)
{ {
Logging.Warning($"[FlippableCard] Not enough Image components in progress bar! Expected {cardsToUpgrade}, found {progressElements.Length}"); Debug.LogWarning($"[FlippableCard] Not enough Image components in progress bar! Expected {cardsToUpgrade}, found {progressElements.Length}");
onComplete?.Invoke(); onComplete?.Invoke();
return; return;
} }
@@ -648,7 +647,7 @@ namespace UI.CardSystem
{ {
if (albumCard == null) if (albumCard == null)
{ {
Logging.Warning("[FlippableCard] Cannot extract AlbumCard - none found!"); Debug.LogWarning("[FlippableCard] Cannot extract AlbumCard - none found!");
return null; return null;
} }
@@ -662,7 +661,7 @@ namespace UI.CardSystem
albumCard.SetupCard(_cardData); albumCard.SetupCard(_cardData);
} }
Logging.Debug($"[FlippableCard] Extracted AlbumCard '{_cardData?.Name}' to {newParent.name} - ready for tween"); Debug.Log($"[FlippableCard] Extracted AlbumCard '{_cardData?.Name}' to {newParent.name} - ready for tween");
return albumCard; return albumCard;
} }

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Collections; using System.Collections;
using Core;
using Data.CardSystem; using Data.CardSystem;
using Pixelplacement; using Pixelplacement;
using UnityEngine; using UnityEngine;
@@ -11,8 +10,7 @@ namespace UI.CardSystem
/// <summary> /// <summary>
/// Singleton UI component for granting booster packs from minigames. /// Singleton UI component for granting booster packs from minigames.
/// Displays a booster pack with glow effect, waits for user to click continue, /// Displays a booster pack with glow effect, waits for user to click continue,
/// then shows the scrapbook button and animates the pack flying to it before granting the reward. /// then animates the pack flying to bottom-left corner before granting the reward.
/// The scrapbook button is automatically hidden after the animation completes.
/// </summary> /// </summary>
public class MinigameBoosterGiver : MonoBehaviour public class MinigameBoosterGiver : MonoBehaviour
{ {
@@ -47,7 +45,7 @@ namespace UI.CardSystem
// Singleton pattern // Singleton pattern
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
{ {
Logging.Warning("[MinigameBoosterGiver] Duplicate instance found. Destroying."); Debug.LogWarning("[MinigameBoosterGiver] Duplicate instance found. Destroying.");
Destroy(gameObject); Destroy(gameObject);
return; return;
} }
@@ -100,7 +98,7 @@ namespace UI.CardSystem
{ {
if (_currentSequence != null) if (_currentSequence != null)
{ {
Logging.Warning("[MinigameBoosterGiver] Already running a sequence. Ignoring new request."); Debug.LogWarning("[MinigameBoosterGiver] Already running a sequence. Ignoring new request.");
return; return;
} }
@@ -189,61 +187,23 @@ namespace UI.CardSystem
yield break; yield break;
} }
// Show scrapbook button temporarily using HUD visibility context // Calculate bottom-left corner position in local space
PlayerHudManager.HudVisibilityContext hudContext = null; RectTransform canvasRect = GetComponentInParent<Canvas>()?.GetComponent<RectTransform>();
GameObject scrapbookButton = null;
scrapbookButton = PlayerHudManager.Instance.GetScrabookButton();
if (scrapbookButton != null)
{
hudContext = PlayerHudManager.Instance.ShowElementTemporarily(scrapbookButton);
}
else
{
Logging.Warning("[MinigameBoosterGiver] Scrapbook button not found in PlayerHudManager.");
}
// Calculate target position - use scrapbook button position if available
Vector3 targetPosition; Vector3 targetPosition;
if (scrapbookButton != null) if (canvasRect != null)
{ {
// Get the scrapbook button's position in the same coordinate space as boosterImage // Convert bottom-left corner with offset to local position
RectTransform scrapbookRect = scrapbookButton.GetComponent<RectTransform>(); Vector2 bottomLeft = new Vector2(-canvasRect.rect.width / 2f, -canvasRect.rect.height / 2f);
if (scrapbookRect != null) targetPosition = bottomLeft + targetBottomLeftOffset;
{
// Convert scrapbook button's world position to local position relative to boosterImage's parent
Canvas canvas = GetComponentInParent<Canvas>();
if (canvas != null && canvas.renderMode == RenderMode.ScreenSpaceOverlay)
{
// For overlay canvas, convert screen position to local position
Vector2 screenPos = RectTransformUtility.WorldToScreenPoint(null, scrapbookRect.position);
RectTransformUtility.ScreenPointToLocalPointInRectangle(
boosterImage.parent as RectTransform,
screenPos,
null,
out Vector2 localPoint);
targetPosition = localPoint;
} }
else else
{ {
// For world space or camera canvas // Fallback if no canvas found
targetPosition = boosterImage.parent.InverseTransformPoint(scrapbookRect.position); targetPosition = _boosterInitialPosition + new Vector3(-500f, -500f, 0f);
}
}
else
{
Logging.Warning("[MinigameBoosterGiver] Scrapbook button has no RectTransform, using fallback position.");
targetPosition = GetFallbackPosition();
}
}
else
{
// Fallback to bottom-left corner
targetPosition = GetFallbackPosition();
} }
// Tween to scrapbook button position // Tween to bottom-left corner
Tween.LocalPosition(boosterImage, targetPosition, disappearDuration, 0f, Tween.EaseInBack); Tween.LocalPosition(boosterImage, targetPosition, disappearDuration, 0f, Tween.EaseInBack);
// Scale down // Scale down
@@ -257,16 +217,13 @@ namespace UI.CardSystem
if (CardSystemManager.Instance != null) if (CardSystemManager.Instance != null)
{ {
CardSystemManager.Instance.AddBoosterPack(1); CardSystemManager.Instance.AddBoosterPack(1);
Logging.Debug("[MinigameBoosterGiver] Booster pack granted!"); Debug.Log("[MinigameBoosterGiver] Booster pack granted!");
} }
else else
{ {
Logging.Warning("[MinigameBoosterGiver] CardSystemManager not found, cannot grant booster pack."); Debug.LogWarning("[MinigameBoosterGiver] CardSystemManager not found, cannot grant booster pack.");
} }
// Hide scrapbook button by disposing the context
hudContext?.Dispose();
// Hide the visual // Hide the visual
if (visualContainer != null) if (visualContainer != null)
{ {
@@ -280,22 +237,6 @@ namespace UI.CardSystem
// Clear sequence reference // Clear sequence reference
_currentSequence = null; _currentSequence = null;
} }
private Vector3 GetFallbackPosition()
{
RectTransform canvasRect = GetComponentInParent<Canvas>()?.GetComponent<RectTransform>();
if (canvasRect != null)
{
// Convert bottom-left corner with offset to local position
Vector2 bottomLeft = new Vector2(-canvasRect.rect.width / 2f, -canvasRect.rect.height / 2f);
return bottomLeft + targetBottomLeftOffset;
}
else
{
// Ultimate fallback if no canvas found
return _boosterInitialPosition + new Vector3(-500f, -500f, 0f);
}
}
} }
} }

View File

@@ -1,6 +1,5 @@
 using System.Collections.Generic;  using System.Collections.Generic;
using Core; using UI.DragAndDrop.Core;
using UI.DragAndDrop.Core;
using UnityEngine; using UnityEngine;
namespace UI.CardSystem namespace UI.CardSystem
@@ -23,7 +22,7 @@ namespace UI.CardSystem
if (container == null || objects == null || objects.Count == 0) if (container == null || objects == null || objects.Count == 0)
return; return;
Logging.Debug($"[SlotContainerHelper] Shuffling {objects.Count} objects to front slots"); Debug.Log($"[SlotContainerHelper] Shuffling {objects.Count} objects to front slots");
// Unassign all objects from their current slots // Unassign all objects from their current slots
foreach (var obj in objects) foreach (var obj in objects)
@@ -42,12 +41,12 @@ namespace UI.CardSystem
if (targetSlot != null) if (targetSlot != null)
{ {
Logging.Debug($"[SlotContainerHelper] Assigning object to slot with SlotIndex {i}"); Debug.Log($"[SlotContainerHelper] Assigning object to slot with SlotIndex {i}");
obj.AssignToSlot(targetSlot, animate); obj.AssignToSlot(targetSlot, animate);
} }
else else
{ {
Logging.Warning($"[SlotContainerHelper] Could not find slot with SlotIndex {i}"); Debug.LogWarning($"[SlotContainerHelper] Could not find slot with SlotIndex {i}");
} }
} }
} }

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Collections; using System.Collections;
using Core;
using Pixelplacement; using Pixelplacement;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
@@ -80,10 +79,10 @@ namespace UI.DragAndDrop.Core
protected virtual void Initialize() protected virtual void Initialize()
{ {
Logging.Debug($"[DraggableObject] Initializing {name} at world pos {transform.position}, local pos {transform.localPosition}, parent: {(transform.parent != null ? transform.parent.name : "NULL")}"); Debug.Log($"[DraggableObject] Initializing {name} at world pos {transform.position}, local pos {transform.localPosition}, parent: {(transform.parent != null ? transform.parent.name : "NULL")}");
_canvas = GetComponentInParent<Canvas>(); _canvas = GetComponentInParent<Canvas>();
Logging.Debug($"[DraggableObject] {name} found canvas: {(_canvas != null ? _canvas.name : "NULL")}, canvas pos: {(_canvas != null ? _canvas.transform.position.ToString() : "N/A")}"); Debug.Log($"[DraggableObject] {name} found canvas: {(_canvas != null ? _canvas.name : "NULL")}, canvas pos: {(_canvas != null ? _canvas.transform.position.ToString() : "N/A")}");
_imageComponent = GetComponent<Image>(); _imageComponent = GetComponent<Image>();
_canvasGroup = GetComponent<CanvasGroup>(); _canvasGroup = GetComponent<CanvasGroup>();
@@ -96,7 +95,7 @@ namespace UI.DragAndDrop.Core
_imageComponent = gameObject.AddComponent<Image>(); _imageComponent = gameObject.AddComponent<Image>();
_imageComponent.color = new Color(1, 1, 1, 0.01f); // Nearly transparent (0 doesn't work) _imageComponent.color = new Color(1, 1, 1, 0.01f); // Nearly transparent (0 doesn't work)
_imageComponent.raycastTarget = true; _imageComponent.raycastTarget = true;
Logging.Debug($"[DraggableObject] Added invisible Image to {name} for raycast detection"); Debug.Log($"[DraggableObject] Added invisible Image to {name} for raycast detection");
} }
// Use assigned visual, or find in children recursively if not assigned // Use assigned visual, or find in children recursively if not assigned
@@ -191,19 +190,19 @@ namespace UI.DragAndDrop.Core
if (eventData.button != PointerEventData.InputButton.Left) if (eventData.button != PointerEventData.InputButton.Left)
return; return;
Logging.Debug($"[DraggableObject] OnBeginDrag called on {name}. _isDraggingEnabled={_isDraggingEnabled}"); Debug.Log($"[DraggableObject] OnBeginDrag called on {name}. _isDraggingEnabled={_isDraggingEnabled}");
// Check if dragging is enabled BEFORE setting any state // Check if dragging is enabled BEFORE setting any state
if (!_isDraggingEnabled) if (!_isDraggingEnabled)
{ {
Logging.Debug($"[DraggableObject] OnBeginDrag blocked - dragging disabled on {name}"); Debug.Log($"[DraggableObject] OnBeginDrag blocked - dragging disabled on {name}");
return; return;
} }
_isDragging = true; _isDragging = true;
_wasDragged = true; _wasDragged = true;
Logging.Debug($"[DraggableObject] Drag started on {name}"); Debug.Log($"[DraggableObject] Drag started on {name}");
// ...existing code... // ...existing code...
if (_canvas != null && _canvas.renderMode == RenderMode.ScreenSpaceOverlay && RectTransform != null) if (_canvas != null && _canvas.renderMode == RenderMode.ScreenSpaceOverlay && RectTransform != null)
@@ -414,7 +413,7 @@ namespace UI.DragAndDrop.Core
if (slot == null) if (slot == null)
return; return;
Logging.Debug($"[DraggableObject] Assigning {name} to slot {slot.name}, animate={animate}, current pos={transform.position}, slot pos={slot.transform.position}"); Debug.Log($"[DraggableObject] Assigning {name} to slot {slot.name}, animate={animate}, current pos={transform.position}, slot pos={slot.transform.position}");
DraggableSlot previousSlot = _currentSlot; DraggableSlot previousSlot = _currentSlot;
_currentSlot = slot; _currentSlot = slot;
@@ -430,7 +429,7 @@ namespace UI.DragAndDrop.Core
transform.SetParent(slot.transform); transform.SetParent(slot.transform);
transform.localPosition = _isSelected ? new Vector3(0, selectionOffset, 0) : Vector3.zero; transform.localPosition = _isSelected ? new Vector3(0, selectionOffset, 0) : Vector3.zero;
transform.localRotation = Quaternion.identity; transform.localRotation = Quaternion.identity;
Logging.Debug($"[DraggableObject] {name} assigned to slot {slot.name}, new world pos={transform.position}, local pos={transform.localPosition}"); Debug.Log($"[DraggableObject] {name} assigned to slot {slot.name}, new world pos={transform.position}, local pos={transform.localPosition}");
} }
OnSlotChanged?.Invoke(this, slot); OnSlotChanged?.Invoke(this, slot);
@@ -511,14 +510,14 @@ namespace UI.DragAndDrop.Core
/// </summary> /// </summary>
public virtual void SetDraggingEnabled(bool enabled) public virtual void SetDraggingEnabled(bool enabled)
{ {
Logging.Debug($"[DraggableObject] SetDraggingEnabled({enabled}) called on {name}. _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}"); Debug.Log($"[DraggableObject] SetDraggingEnabled({enabled}) called on {name}. _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}");
_isDraggingEnabled = enabled; _isDraggingEnabled = enabled;
// If disabling dragging while actively dragging, stop the drag // If disabling dragging while actively dragging, stop the drag
if (!enabled && _isDragging) if (!enabled && _isDragging)
{ {
Logging.Debug($"[DraggableObject] Stopping active drag on {name}"); Debug.Log($"[DraggableObject] Stopping active drag on {name}");
_isDragging = false; _isDragging = false;
// Re-enable raycasting // Re-enable raycasting
@@ -530,7 +529,7 @@ namespace UI.DragAndDrop.Core
_canvasGroup.blocksRaycasts = true; _canvasGroup.blocksRaycasts = true;
} }
Logging.Debug($"[DraggableObject] After SetDraggingEnabled: _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}"); Debug.Log($"[DraggableObject] After SetDraggingEnabled: _isDragging={_isDragging}, _isDraggingEnabled={_isDraggingEnabled}");
} }
#endregion #endregion

View File

@@ -1,5 +1,4 @@
using Core; using Pixelplacement;
using Pixelplacement;
using Pixelplacement.TweenSystem; using Pixelplacement.TweenSystem;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; // Added for new Input System using UnityEngine.InputSystem; // Added for new Input System
@@ -68,14 +67,14 @@ namespace UI.DragAndDrop.Core
_parentDraggable = parent; _parentDraggable = parent;
Canvas parentCanvas = parent.GetComponentInParent<Canvas>(); Canvas parentCanvas = parent.GetComponentInParent<Canvas>();
Logging.Debug($"[DraggableVisual] Initializing visual for {parent.name} at world pos {parent.transform.position}, parent canvas: {(parentCanvas != null ? parentCanvas.name + " (renderMode: " + parentCanvas.renderMode + ")" : "NULL")}"); Debug.Log($"[DraggableVisual] Initializing visual for {parent.name} at world pos {parent.transform.position}, parent canvas: {(parentCanvas != null ? parentCanvas.name + " (renderMode: " + parentCanvas.renderMode + ")" : "NULL")}");
// CRITICAL: Reparent visual to canvas (not base) so it can move independently // CRITICAL: Reparent visual to canvas (not base) so it can move independently
// This enables the delayed follow effect // This enables the delayed follow effect
if (parentCanvas != null) if (parentCanvas != null)
{ {
transform.SetParent(parentCanvas.transform, true); // worldPositionStays = true transform.SetParent(parentCanvas.transform, true); // worldPositionStays = true
Logging.Debug($"[DraggableVisual] Reparented visual {name} to canvas {parentCanvas.name} for independent movement"); Debug.Log($"[DraggableVisual] Reparented visual {name} to canvas {parentCanvas.name} for independent movement");
} }
// Get components if assigned (don't auto-create Canvas to avoid Unity's auto-reparenting) // Get components if assigned (don't auto-create Canvas to avoid Unity's auto-reparenting)
@@ -107,7 +106,7 @@ namespace UI.DragAndDrop.Core
tiltParent.localRotation = Quaternion.identity; tiltParent.localRotation = Quaternion.identity;
} }
Logging.Debug($"[DraggableVisual] Visual {name} initialized at world pos {transform.position}, local pos {transform.localPosition}, local rotation {transform.localRotation.eulerAngles}, parent at world pos {parent.transform.position}, local pos {parent.transform.localPosition}, rotation {parent.transform.rotation.eulerAngles}"); Debug.Log($"[DraggableVisual] Visual {name} initialized at world pos {transform.position}, local pos {transform.localPosition}, local rotation {transform.localRotation.eulerAngles}, parent at world pos {parent.transform.position}, local pos {parent.transform.localPosition}, rotation {parent.transform.rotation.eulerAngles}");
_isInitialized = true; _isInitialized = true;
@@ -203,7 +202,7 @@ namespace UI.DragAndDrop.Core
float distance = Vector3.Distance(currentPosition, targetPosition); float distance = Vector3.Distance(currentPosition, targetPosition);
if (distance > 500f) if (distance > 500f)
{ {
Logging.Warning($"[DraggableVisual] Large position delta detected! Visual {name} at {currentPosition}, target {targetPosition}, parent {_parentDraggable.name}, distance: {distance}"); Debug.LogWarning($"[DraggableVisual] Large position delta detected! Visual {name} at {currentPosition}, target {targetPosition}, parent {_parentDraggable.name}, distance: {distance}");
} }
// Apply follow logic with snappy easing // Apply follow logic with snappy easing

View File

@@ -1,5 +1,4 @@
using Core; using UI.Core;
using UI.Core;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@@ -54,7 +53,7 @@ namespace UI
return; return;
} }
Logging.Debug($"[HudMenuButton] {buttonName} opening page from prefab: {pagePrefab.name}"); Debug.Log($"[HudMenuButton] {buttonName} opening page from prefab: {pagePrefab.name}");
UIPageController.Instance.PushPageFromPrefab(pagePrefab); UIPageController.Instance.PushPageFromPrefab(pagePrefab);
} }

View File

@@ -7,7 +7,6 @@ using UnityEngine.Playables;
using UnityEngine.UI; using UnityEngine.UI;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System;
namespace UI namespace UI
{ {
@@ -20,73 +19,6 @@ namespace UI
{ {
public enum UIMode { Overworld, Puzzle, Minigame, HideAll }; public enum UIMode { Overworld, Puzzle, Minigame, HideAll };
/// <summary>
/// Context object for managing temporary HUD element visibility.
/// Automatically restores previous visibility state when disposed.
/// Usage: using (var ctx = PlayerHudManager.Instance.ShowElementTemporarily(myButton)) { ... }
/// </summary>
public class HudVisibilityContext : IDisposable
{
private readonly GameObject _element;
private readonly bool _previousState;
private bool _disposed;
internal HudVisibilityContext(GameObject element, bool show)
{
_element = element;
_previousState = element.activeSelf;
_element.SetActive(show);
}
public void Dispose()
{
if (_disposed) return;
_disposed = true;
if (_element != null)
{
_element.SetActive(_previousState);
}
}
}
/// <summary>
/// Multi-element visibility context for managing multiple HUD elements at once.
/// Automatically restores previous visibility states when disposed.
/// </summary>
public class MultiHudVisibilityContext : IDisposable
{
private readonly List<(GameObject element, bool previousState)> _elements;
private bool _disposed;
internal MultiHudVisibilityContext(IEnumerable<GameObject> elements, bool show)
{
_elements = new List<(GameObject, bool)>();
foreach (var element in elements)
{
if (element != null)
{
_elements.Add((element, element.activeSelf));
element.SetActive(show);
}
}
}
public void Dispose()
{
if (_disposed) return;
_disposed = true;
foreach (var (element, previousState) in _elements)
{
if (element != null)
{
element.SetActive(previousState);
}
}
}
}
public UIMode currentUIMode; public UIMode currentUIMode;
[Header("HUD Management")] [Header("HUD Management")]
@@ -101,7 +33,6 @@ namespace UI
[Header("HUD Elements")] [Header("HUD Elements")]
public GameObject eagleEye; public GameObject eagleEye;
public GameObject ramaSjangButton; public GameObject ramaSjangButton;
public GameObject scrabBookButton;
[HideInInspector] public Image cinematicSprites; [HideInInspector] public Image cinematicSprites;
[HideInInspector] public Image cinematicBackgroundSprites; [HideInInspector] public Image cinematicBackgroundSprites;
@@ -323,9 +254,6 @@ namespace UI
if (visible) if (visible)
{ {
eagleEye.SetActive(false); eagleEye.SetActive(false);
ramaSjangButton.SetActive(false);
scrabBookButton.SetActive(false);
} }
break; break;
case UIMode.HideAll: case UIMode.HideAll:
@@ -390,64 +318,6 @@ namespace UI
UnityEngine.Debug.LogError("[PlayerHudManager] Cannot push page - UIPageController not found!"); UnityEngine.Debug.LogError("[PlayerHudManager] Cannot push page - UIPageController not found!");
} }
} }
#region HUD Element Getters
public GameObject GetEagleEye() => eagleEye;
public GameObject GetRamaSjangButton() => ramaSjangButton;
public GameObject GetScrabookButton() => scrabBookButton;
#endregion
#region Context-Based Visibility Management
/// <summary>
/// Temporarily shows a HUD element. Returns a context object that restores the previous state when disposed.
/// Usage: using (var ctx = PlayerHudManager.Instance.ShowElementTemporarily(myButton)) { /* element is visible */ }
/// </summary>
public HudVisibilityContext ShowElementTemporarily(GameObject element)
{
if (element == null)
{
Logging.Warning("[PlayerHudManager] Attempted to show null element");
return null;
}
return new HudVisibilityContext(element, true);
}
/// <summary>
/// Temporarily hides a HUD element. Returns a context object that restores the previous state when disposed.
/// Usage: using (var ctx = PlayerHudManager.Instance.HideElementTemporarily(myButton)) { /* element is hidden */ }
/// </summary>
public HudVisibilityContext HideElementTemporarily(GameObject element)
{
if (element == null)
{
Logging.Warning("[PlayerHudManager] Attempted to hide null element");
return null;
}
return new HudVisibilityContext(element, false);
}
/// <summary>
/// Temporarily shows multiple HUD elements. Returns a context object that restores all previous states when disposed.
/// Usage: using (var ctx = PlayerHudManager.Instance.ShowElementsTemporarily(button1, button2, button3)) { /* elements are visible */ }
/// </summary>
public MultiHudVisibilityContext ShowElementsTemporarily(params GameObject[] elements)
{
return new MultiHudVisibilityContext(elements, true);
}
/// <summary>
/// Temporarily hides multiple HUD elements. Returns a context object that restores all previous states when disposed.
/// Usage: using (var ctx = PlayerHudManager.Instance.HideElementsTemporarily(button1, button2, button3)) { /* elements are hidden */ }
/// </summary>
public MultiHudVisibilityContext HideElementsTemporarily(params GameObject[] elements)
{
return new MultiHudVisibilityContext(elements, false);
}
#endregion
} }
} }

View File

@@ -15,6 +15,6 @@ public class ScrapbookController : MonoBehaviour
public void DebugClick() public void DebugClick()
{ {
// Logging.Debug("Yey I was clicked!"); // Debug.Log("Yey I was clicked!");
} }
} }

View File

@@ -59,7 +59,7 @@ namespace UI.Tutorial
void RemoveTutorial() void RemoveTutorial()
{ {
Logging.Debug("Remove me!"); Debug.Log("Remove me!");
if (_waitLoopCoroutine != null) if (_waitLoopCoroutine != null)
{ {
StopCoroutine(_waitLoopCoroutine); StopCoroutine(_waitLoopCoroutine);

View File

@@ -101,7 +101,7 @@ namespace Utils
} }
catch (System.Exception ex) catch (System.Exception ex)
{ {
Logging.Warning($"[AppleHillsUtils] Error checking addressable key existence: {ex.Message}"); Debug.LogWarning($"[AppleHillsUtils] Error checking addressable key existence: {ex.Message}");
return false; return false;
} }
} }