Lifecycle System Refactor & Logging Centralization #56
@@ -56,7 +56,7 @@ public class BirdEyesBehavior : ManagedBehaviour
|
||||
_statemachine.ChangeState("BirdSpawned");
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
base.OnSceneRestoreRequested(serializedData);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BirdEyesBehavior : ManagedBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
return _wolterisoutTriggered.ToString();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Bootstrap
|
||||
// Run very early - need to set up loading screen before other systems initialize
|
||||
public override int ManagedAwakePriority => 5;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
LogDebugMessage("BootSceneController.Awake() - Initializing loading screen DURING bootstrap");
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Bootstrap
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
LogDebugMessage("BootSceneController.OnManagedStart() - Boot is GUARANTEED complete, starting scene loading");
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ namespace Cinematics
|
||||
|
||||
public override int ManagedAwakePriority => 170; // Cinematic systems
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug("[CinematicsManager] Initialized");
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Cinematics
|
||||
|
||||
public override int ManagedAwakePriority => 180; // Cinematic UI
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Reset the progress bar
|
||||
if (radialProgressBar != null)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Core
|
||||
// ManagedBehaviour configuration
|
||||
public override int ManagedAwakePriority => 10; // Core infrastructure - runs early
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -55,7 +55,7 @@ namespace Core
|
||||
_managerLogVerbosity = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>().gameManagerLogVerbosity;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Settings are already initialized in OnManagedAwake()
|
||||
// This is available for future initialization that depends on other managers
|
||||
|
||||
@@ -50,18 +50,18 @@ namespace Core
|
||||
|
||||
public override int ManagedAwakePriority => 75; // Item registry
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug("[ItemManager] Initialized");
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
// Replaces SceneLoadStarted subscription for clearing registrations
|
||||
ClearAllRegistrations();
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Core.Lifecycle
|
||||
// Call OnManagedAwake immediately after registration (early initialization hook)
|
||||
try
|
||||
{
|
||||
component.InvokeManagedAwake();
|
||||
component.OnManagedAwake();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ namespace Core.Lifecycle
|
||||
LogDebug($"Late registration: Calling OnManagedStart immediately for {component.gameObject.name}");
|
||||
try
|
||||
{
|
||||
component.InvokeManagedStart();
|
||||
component.OnManagedStart();
|
||||
HandleAutoRegistrations(component);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -174,7 +174,7 @@ namespace Core.Lifecycle
|
||||
LogDebug($"Late registration: Calling OnSceneReady immediately for {component.gameObject.name}");
|
||||
try
|
||||
{
|
||||
component.InvokeSceneReady();
|
||||
component.OnSceneReady();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
component.InvokeManagedStart();
|
||||
component.OnManagedStart();
|
||||
HandleAutoRegistrations(component);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -292,7 +292,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
component.InvokeManagedStart();
|
||||
component.OnManagedStart();
|
||||
HandleAutoRegistrations(component);
|
||||
LogDebug($"Processed batched component: {component.gameObject.name} (Priority: {component.ManagedAwakePriority})");
|
||||
}
|
||||
@@ -325,7 +325,7 @@ namespace Core.Lifecycle
|
||||
{
|
||||
try
|
||||
{
|
||||
component.InvokeSceneUnloading();
|
||||
component.OnSceneUnloading();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -361,7 +361,7 @@ namespace Core.Lifecycle
|
||||
{
|
||||
try
|
||||
{
|
||||
component.InvokeSceneReady();
|
||||
component.OnSceneReady();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -389,7 +389,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
string serializedData = component.InvokeSceneSaveRequested();
|
||||
string serializedData = component.OnSceneSaveRequested();
|
||||
if (!string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
string saveId = component.SaveId;
|
||||
@@ -425,7 +425,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
string serializedData = component.InvokeGlobalSaveRequested();
|
||||
string serializedData = component.OnGlobalSaveRequested();
|
||||
if (!string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
saveData[component.SaveId] = serializedData;
|
||||
@@ -465,7 +465,7 @@ namespace Core.Lifecycle
|
||||
{
|
||||
try
|
||||
{
|
||||
component.InvokeSceneRestoreRequested(serializedData);
|
||||
component.OnSceneRestoreRequested(serializedData);
|
||||
restoredCount++;
|
||||
LogDebug($"Restored scene data to: {component.SaveId}");
|
||||
}
|
||||
@@ -496,7 +496,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
component.InvokeSceneRestoreCompleted();
|
||||
component.OnSceneRestoreCompleted();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -529,7 +529,7 @@ namespace Core.Lifecycle
|
||||
{
|
||||
try
|
||||
{
|
||||
component.InvokeGlobalRestoreRequested(serializedData);
|
||||
component.OnGlobalRestoreRequested(serializedData);
|
||||
restoredCount++;
|
||||
LogDebug($"Restored global data to: {component.SaveId}");
|
||||
}
|
||||
@@ -561,7 +561,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
component.InvokeGlobalLoadCompleted();
|
||||
component.OnGlobalLoadCompleted();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -588,7 +588,7 @@ namespace Core.Lifecycle
|
||||
|
||||
try
|
||||
{
|
||||
component.InvokeGlobalSaveStarted();
|
||||
component.OnGlobalSaveStarted();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -80,24 +80,6 @@ namespace Core.Lifecycle
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Accessors (for LifecycleManager)
|
||||
|
||||
// Public wrappers to invoke protected lifecycle methods
|
||||
public void InvokeManagedAwake() => OnManagedAwake();
|
||||
public void InvokeManagedStart() => OnManagedStart();
|
||||
public void InvokeSceneUnloading() => OnSceneUnloading();
|
||||
public void InvokeSceneReady() => OnSceneReady();
|
||||
public string InvokeSceneSaveRequested() => OnSceneSaveRequested();
|
||||
public void InvokeSceneRestoreRequested(string data) => OnSceneRestoreRequested(data);
|
||||
public void InvokeSceneRestoreCompleted() => OnSceneRestoreCompleted();
|
||||
public string InvokeGlobalSaveRequested() => OnGlobalSaveRequested();
|
||||
public void InvokeGlobalRestoreRequested(string data) => OnGlobalRestoreRequested(data);
|
||||
public void InvokeManagedDestroy() => OnManagedDestroy();
|
||||
public void InvokeGlobalLoadCompleted() => OnGlobalLoadCompleted();
|
||||
public void InvokeGlobalSaveStarted() => OnGlobalSaveStarted();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool _isRegistered;
|
||||
@@ -157,8 +139,9 @@ namespace Core.Lifecycle
|
||||
/// Use for early initialization such as setting singleton instances.
|
||||
/// TIMING: Fires during component's Awake(), no execution order guarantees between components.
|
||||
/// NOT priority-ordered - fires whenever Unity calls this component's Awake().
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnManagedAwake()
|
||||
internal virtual void OnManagedAwake()
|
||||
{
|
||||
// Override in derived classes
|
||||
}
|
||||
@@ -169,8 +152,9 @@ namespace Core.Lifecycle
|
||||
/// For boot-time components: Called during LifecycleManager.BroadcastManagedStart (priority ordered).
|
||||
/// For late-registered components: Called immediately upon registration (bootstrap already complete).
|
||||
/// Use for initialization that depends on other systems.
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnManagedStart()
|
||||
internal virtual void OnManagedStart()
|
||||
{
|
||||
// Override in derived classes
|
||||
}
|
||||
@@ -179,8 +163,9 @@ namespace Core.Lifecycle
|
||||
/// Called before the scene this component belongs to is unloaded.
|
||||
/// Called in REVERSE priority order (higher values execute first).
|
||||
/// Use for scene-specific cleanup.
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnSceneUnloading()
|
||||
internal virtual void OnSceneUnloading()
|
||||
{
|
||||
// Override in derived classes
|
||||
}
|
||||
@@ -189,8 +174,9 @@ namespace Core.Lifecycle
|
||||
/// Called after the scene this component belongs to has finished loading.
|
||||
/// Called in priority order (lower values execute first).
|
||||
/// Use for scene-specific initialization.
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnSceneReady()
|
||||
internal virtual void OnSceneReady()
|
||||
{
|
||||
// Override in derived classes
|
||||
}
|
||||
@@ -204,8 +190,10 @@ namespace Core.Lifecycle
|
||||
/// - Called BEFORE scene unload during scene transitions
|
||||
/// - Frequency: Every scene transition
|
||||
/// - Use for: Level progress, object positions, puzzle states
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual string OnSceneSaveRequested()
|
||||
internal virtual string OnSceneSaveRequested()
|
||||
{
|
||||
return null; // Default: no data to save
|
||||
}
|
||||
@@ -222,8 +210,10 @@ namespace Core.Lifecycle
|
||||
/// - Called AFTER scene load, during OnSceneReady phase
|
||||
/// - Frequency: Every scene transition
|
||||
/// - Use for: Restoring level progress, object positions, puzzle states
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnSceneRestoreRequested(string serializedData)
|
||||
internal virtual void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
// Default: no-op
|
||||
}
|
||||
@@ -245,8 +235,10 @@ namespace Core.Lifecycle
|
||||
/// 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).
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnSceneRestoreCompleted()
|
||||
internal virtual void OnSceneRestoreCompleted()
|
||||
{
|
||||
// Default: no-op
|
||||
}
|
||||
@@ -259,8 +251,10 @@ namespace Core.Lifecycle
|
||||
/// - Called ONCE on game boot after save file is read
|
||||
/// - NOT called during scene transitions
|
||||
/// - Use for: Player inventory, unlocked features, card collections
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnGlobalRestoreRequested(string serializedData)
|
||||
internal virtual void OnGlobalRestoreRequested(string serializedData)
|
||||
{
|
||||
// Default: no-op
|
||||
}
|
||||
@@ -274,8 +268,10 @@ namespace Core.Lifecycle
|
||||
/// - Called ONCE before save file is written (on quit, manual save, etc.)
|
||||
/// - NOT called during scene transitions
|
||||
/// - Use for: Player inventory, unlocked features, card collections
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual string OnGlobalSaveRequested()
|
||||
internal virtual string OnGlobalSaveRequested()
|
||||
{
|
||||
return null; // Default: no data to save
|
||||
}
|
||||
@@ -289,8 +285,10 @@ namespace Core.Lifecycle
|
||||
/// - Called ONCE on game boot after all restore operations complete
|
||||
/// - NOT called during scene transitions
|
||||
/// - Use for: Triggering UI updates, broadcasting load events
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnGlobalLoadCompleted()
|
||||
internal virtual void OnGlobalLoadCompleted()
|
||||
{
|
||||
// Default: no-op
|
||||
}
|
||||
@@ -304,8 +302,10 @@ namespace Core.Lifecycle
|
||||
/// - Called ONCE before save file is written
|
||||
/// - NOT called during scene transitions
|
||||
/// - Use for: Final validation, cleanup operations
|
||||
///
|
||||
/// NOTE: Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnGlobalSaveStarted()
|
||||
internal virtual void OnGlobalSaveStarted()
|
||||
{
|
||||
// Default: no-op
|
||||
}
|
||||
@@ -315,8 +315,9 @@ namespace Core.Lifecycle
|
||||
/// Called in REVERSE priority order (higher values execute first).
|
||||
/// NOTE: Most cleanup is automatic (managed events, auto-registrations).
|
||||
/// Only override if you need custom cleanup logic.
|
||||
/// Internal visibility allows LifecycleManager to call directly. Override in derived classes.
|
||||
/// </summary>
|
||||
protected virtual void OnManagedDestroy()
|
||||
internal virtual void OnManagedDestroy()
|
||||
{
|
||||
// Override in derived classes
|
||||
}
|
||||
|
||||
@@ -129,18 +129,18 @@ namespace AppleHills.Core
|
||||
|
||||
#region Lifecycle Methods
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// QuickAccess has minimal initialization
|
||||
}
|
||||
|
||||
protected override void OnSceneUnloading()
|
||||
internal override void OnSceneUnloading()
|
||||
{
|
||||
// Clear references BEFORE scene unloads for better cleanup timing
|
||||
ClearReferences();
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Core.SaveLoad
|
||||
// ManagedBehaviour configuration
|
||||
public override int ManagedAwakePriority => 20; // After GameManager and SceneManagerService
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -56,7 +56,7 @@ namespace Core.SaveLoad
|
||||
IsRestoringState = false;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug("[SaveLoadManager] Initialized");
|
||||
|
||||
@@ -67,19 +67,19 @@ namespace Core.SaveLoad
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
// SaveableInteractables now auto-register via ManagedBehaviour lifecycle
|
||||
// No need to discover and register them manually
|
||||
}
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
// SaveLoadManager orchestrates saves, doesn't participate in them
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override string OnGlobalSaveRequested()
|
||||
internal override string OnGlobalSaveRequested()
|
||||
{
|
||||
// SaveLoadManager orchestrates saves, doesn't participate in them
|
||||
return null;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Core
|
||||
// Enable save/load participation
|
||||
public override bool AutoRegisterForSave => true;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake();
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Core
|
||||
|
||||
#region Save/Load Implementation
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
var saveData = new PlayableDirectorSaveData
|
||||
{
|
||||
@@ -77,7 +77,7 @@ namespace Core
|
||||
return JsonUtility.ToJson(saveData);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Core
|
||||
// ManagedBehaviour configuration
|
||||
public override int ManagedAwakePriority => 15; // Core infrastructure, after GameManager
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -63,7 +63,7 @@ namespace Core
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Set up loading screen reference and events
|
||||
// This must happen in ManagedStart because LoadingScreenController instance needs to be set first
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Core
|
||||
// ManagedBehaviour configuration
|
||||
public override int ManagedAwakePriority => 70; // Platform-specific utility
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -32,7 +32,7 @@ namespace Core
|
||||
LogDebugMessage("Initialized");
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Subscribe to SceneManagerService to enforce orientation on every scene load
|
||||
if (SceneManagerService.Instance != null)
|
||||
@@ -49,7 +49,7 @@ namespace Core
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
// Handle orientation when scene is ready (initial scene)
|
||||
// Note: This fires for the scene that just loaded, LifecycleManager tracks which scene
|
||||
|
||||
@@ -33,14 +33,14 @@ public class PicnicBehaviour : ManagedBehaviour
|
||||
// Runtime state tracking
|
||||
private bool _fakeChocolateDestroyed;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
stateMachine = GetComponent<AppleMachine>();
|
||||
animator = GetComponent<Animator>();
|
||||
_audioSource = GetComponent<AppleAudioSource>();
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreCompleted()
|
||||
internal override void OnSceneRestoreCompleted()
|
||||
{
|
||||
if (_fakeChocolateDestroyed)
|
||||
{
|
||||
@@ -120,13 +120,13 @@ public class PicnicBehaviour : ManagedBehaviour
|
||||
_audioSource.Play(0);
|
||||
}
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
var state = new PicnicBehaviourState { fakeChocolateDestroyed = _fakeChocolateDestroyed };
|
||||
return JsonUtility.ToJson(state);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData)) return;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class soundBird_CanFly : ManagedBehaviour
|
||||
|
||||
#region Save/Load Implementation
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
var saveData = new SoundBirdSaveData
|
||||
{
|
||||
@@ -32,7 +32,7 @@ public class soundBird_CanFly : ManagedBehaviour
|
||||
return JsonUtility.ToJson(saveData);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Data.CardSystem
|
||||
|
||||
public override int ManagedAwakePriority => 60; // Data systems
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -56,7 +56,7 @@ namespace Data.CardSystem
|
||||
LoadCardDefinitionsFromAddressables();
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug("[CardSystemManager] Initialized");
|
||||
}
|
||||
@@ -718,13 +718,13 @@ namespace Data.CardSystem
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
protected override string OnGlobalSaveRequested()
|
||||
internal override string OnGlobalSaveRequested()
|
||||
{
|
||||
var state = ExportCardCollectionState();
|
||||
return JsonUtility.ToJson(state);
|
||||
}
|
||||
|
||||
protected override void OnGlobalRestoreRequested(string serializedData)
|
||||
internal override void OnGlobalRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Dialogue
|
||||
|
||||
public override int ManagedAwakePriority => 150; // Dialogue systems
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Get required components
|
||||
appleAudioSource = GetComponent<AppleAudioSource>();
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Input
|
||||
|
||||
public override int ManagedAwakePriority => 25; // Input infrastructure
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -87,7 +87,7 @@ namespace Input
|
||||
SwitchInputOnSceneLoaded(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Subscribe to scene load events from SceneManagerService
|
||||
// This must happen in ManagedStart because SceneManagerService instance needs to be set first
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Input
|
||||
public override string SaveId => $"{gameObject.scene.name}/PlayerController";
|
||||
public override int ManagedAwakePriority => 100; // Player controller
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
aiPath = GetComponent<AIPath>();
|
||||
artTransform = transform.Find("CharacterArt");
|
||||
@@ -435,7 +435,7 @@ namespace Input
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
var saveData = new PlayerSaveData
|
||||
{
|
||||
@@ -445,7 +445,7 @@ namespace Input
|
||||
return JsonUtility.ToJson(saveData);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Interactions
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake(); // SaveableInteractable registration
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Interactions
|
||||
public event Action<PickupItemData> OnItemPickedUp;
|
||||
public event Action<PickupItemData, PickupItemData, PickupItemData> OnItemsCombined;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake(); // Register with save system
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Interactions
|
||||
|
||||
// Always register with ItemManager, even if picked up
|
||||
// This allows the save/load system to find held items when restoring state
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
base.OnManagedStart();
|
||||
ItemManager.Instance?.RegisterPickup(this);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Interactions
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
object stateData = GetSerializableState();
|
||||
if (stateData == null)
|
||||
@@ -35,7 +35,7 @@ namespace Interactions
|
||||
return JsonUtility.ToJson(stateData);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Levels
|
||||
/// <summary>
|
||||
/// Unity Awake callback. Sets up icon, interactable, and event handlers.
|
||||
/// </summary>
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake();
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Levels
|
||||
ApplySwitchData();
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug($"[LevelSwitch] OnManagedStart called for {gameObject.name}");
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
Logging.Debug($"[LevelSwitch] OnSceneReady called for {gameObject.name}");
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Levels
|
||||
/// <summary>
|
||||
/// Unity Awake callback. Sets up icon, interactable, and event handlers.
|
||||
/// </summary>
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake();
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Levels
|
||||
ApplySwitchData();
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
base.OnManagedStart();
|
||||
// If startUnlocked is true, always start active
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Minigames.DivingForPictures
|
||||
public override int ManagedAwakePriority => 190;
|
||||
public override bool AutoRegisterPausable => true; // Automatic GameManager registration
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ namespace Minigames.DivingForPictures
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
_settings = GameManager.GetSettingsObject<IDivingMinigameSettings>();
|
||||
_currentSpawnProbability = _settings?.BaseSpawnProbability ?? 0.2f;
|
||||
@@ -130,7 +130,7 @@ namespace Minigames.DivingForPictures
|
||||
Logging.Debug("[DivingGameManager] Initialized");
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
InitializeGame();
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class FollowerController : ManagedBehaviour
|
||||
|
||||
public override int ManagedAwakePriority => 110; // Follower after player
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
_aiPath = GetComponent<AIPath>();
|
||||
// Find art prefab and animator
|
||||
@@ -129,7 +129,7 @@ public class FollowerController : ManagedBehaviour
|
||||
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
// Find player reference when scene is ready (called for every scene load)
|
||||
FindPlayerReference();
|
||||
@@ -727,7 +727,7 @@ public class FollowerController : ManagedBehaviour
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
var saveData = new FollowerSaveData
|
||||
{
|
||||
@@ -754,7 +754,7 @@ public class FollowerController : ManagedBehaviour
|
||||
return JsonUtility.ToJson(saveData);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace PuzzleS
|
||||
// Save system configuration
|
||||
public override bool AutoRegisterForSave => true;
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Initialize after all managers are ready
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace PuzzleS
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
// Save scene-specific progress
|
||||
var state = new BirdGameState
|
||||
@@ -38,7 +38,7 @@ namespace PuzzleS
|
||||
return JsonUtility.ToJson(state);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace PuzzleS
|
||||
// Enum for tracking proximity state (simplified to just Close and Far)
|
||||
public enum ProximityState { Close, Far }
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
_interactable = GetComponent<InteractableBase>();
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace PuzzleS
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Register with PuzzleManager - safe to access .Instance here
|
||||
if (stepData != null && PuzzleManager.Instance != null)
|
||||
|
||||
@@ -96,13 +96,13 @@ namespace PuzzleS
|
||||
|
||||
public override int ManagedAwakePriority => 80; // Puzzle systems
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Initialize settings reference
|
||||
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
|
||||
@@ -589,7 +589,7 @@ namespace PuzzleS
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
if (_currentLevelData == null)
|
||||
{
|
||||
@@ -609,7 +609,7 @@ namespace PuzzleS
|
||||
return json;
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string data)
|
||||
internal override void OnSceneRestoreRequested(string data)
|
||||
{
|
||||
Logging.Debug("[XAXA] PuzzleManager loading with data: " + data);
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ public class AppleAudioSource : ManagedBehaviour
|
||||
public int sourcePriority;
|
||||
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
AudioManager.Instance.RegisterNewAudioSource(this);
|
||||
_audioMixer = AudioManager.Instance.audioMixer;
|
||||
|
||||
@@ -44,13 +44,13 @@ public class AudioManager : ManagedBehaviour, IPausable
|
||||
public override int ManagedAwakePriority => 30; // Audio infrastructure
|
||||
public override bool AutoRegisterPausable => true; // Auto-register as IPausable
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Initialize lists if they were not set in inspector
|
||||
criticalVOSources = criticalVOSources ?? new List<AppleAudioSource>();
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BushAudioController : ManagedBehaviour
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
_eventSource = VOPlayer.audioSource.RequestEventHandlers();
|
||||
_eventSource.AudioStopped += PlayBirdCounter;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class LevelAudioObject : ManagedBehaviour
|
||||
|
||||
public override bool AutoRegisterForSave => isOneTime; // Only save if one-time audio
|
||||
|
||||
protected override string OnSceneSaveRequested()
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
if (!isOneTime)
|
||||
return null; // No need to save if not one-time
|
||||
@@ -39,7 +39,7 @@ public class LevelAudioObject : ManagedBehaviour
|
||||
return JsonUtility.ToJson(saveData);
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreRequested(string serializedData)
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (!isOneTime || string.IsNullOrEmpty(serializedData))
|
||||
return;
|
||||
@@ -55,7 +55,7 @@ public class LevelAudioObject : ManagedBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSceneRestoreCompleted()
|
||||
internal override void OnSceneRestoreCompleted()
|
||||
{
|
||||
if (isOneTime && !_hasPlayed)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ public class PulverAudioController : ManagedBehaviour
|
||||
private FollowerController followerController;
|
||||
public ItemManager itemManager;
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
followerController = GetComponent<FollowerController>();
|
||||
followerController.PulverIsCombining.AddListener(PulverIsCombining);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class AppSwitcher : UIPage
|
||||
private TweenBase slideInTween;
|
||||
private TweenBase slideOutTween;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace UI.CardSystem
|
||||
private List<AlbumCardPlacementDraggable> _activeCards = new List<AlbumCardPlacementDraggable>();
|
||||
private const int MAX_VISIBLE_CARDS = 3;
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Discover zone tabs from container
|
||||
DiscoverZoneTabs();
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace UI.CardSystem
|
||||
|
||||
private TweenBase _activeTween;
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Store original scale for pulse animation
|
||||
if (dotBackground != null)
|
||||
|
||||
@@ -39,13 +39,13 @@ namespace UI.Core
|
||||
|
||||
public override int ManagedAwakePriority => 50; // UI infrastructure
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug("[UIPageController] Initialized");
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace UI
|
||||
// ManagedBehaviour configuration
|
||||
public override int ManagedAwakePriority => 45; // UI infrastructure, before UIPageController
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -72,7 +72,7 @@ namespace UI
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
Logging.Debug("[LoadingScreenController] Initialized");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace UI
|
||||
// After UIPageController (50)
|
||||
public override int ManagedAwakePriority => 55;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Set instance immediately (early initialization)
|
||||
_instance = this;
|
||||
@@ -49,7 +49,7 @@ namespace UI
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Subscribe to scene-dependent events - must be in OnManagedStart, not OnSceneReady
|
||||
// because PauseMenu is in DontDestroyOnLoad and OnSceneReady only fires once
|
||||
@@ -71,7 +71,7 @@ namespace UI
|
||||
Logging.Debug("[PauseMenu] Subscribed to SceneManagerService events");
|
||||
}
|
||||
|
||||
protected override void OnSceneReady()
|
||||
internal override void OnSceneReady()
|
||||
{
|
||||
// This only fires once for DontDestroyOnLoad objects, so we handle scene loads in OnManagedAwake
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace UI
|
||||
private UIPageController _uiPageController;
|
||||
private AppSwitcher _appSwitcherComponent;
|
||||
|
||||
protected override void OnManagedAwake()
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace UI
|
||||
InitializeReferences();
|
||||
}
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Subscribe to UIPageController page changes for auto HUD management
|
||||
if (_uiPageController != null)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace UI.Tutorial
|
||||
|
||||
public override int ManagedAwakePriority => 200; // Tutorial runs late, after other systems
|
||||
|
||||
protected override void OnManagedStart()
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Ensure prompt is hidden initially (even before tutorial initialization)
|
||||
if (tapPrompt != null)
|
||||
|
||||
Reference in New Issue
Block a user