diff --git a/QSB/QSBSceneManager.cs b/QSB/QSBSceneManager.cs index b13a7a63..57209b3d 100644 --- a/QSB/QSBSceneManager.cs +++ b/QSB/QSBSceneManager.cs @@ -12,9 +12,9 @@ public static class QSBSceneManager public static bool IsInUniverse => CurrentScene.IsUniverseScene(); - [Obsolete] + [Obsolete("TODO: remove after migration")] public static event Action OnSceneLoaded; - [Obsolete] + [Obsolete("TODO: remove after migration")] public static event Action OnUniverseSceneLoaded; /// @@ -30,6 +30,8 @@ public static class QSBSceneManager static QSBSceneManager() { + LoadManager.OnCompleteSceneLoad += OnCompleteSceneLoad; + LoadManager.OnStartSceneLoad += (originalScene, loadScene) => { DebugLog.DebugWrite($"PRE SCENE LOAD ({originalScene} -> {loadScene})", MessageType.Info); @@ -45,6 +47,18 @@ public static class QSBSceneManager DebugLog.DebugWrite("Scene Manager ready.", MessageType.Success); } + [Obsolete("TODO: remove after migration")] + private static void OnCompleteSceneLoad(OWScene oldScene, OWScene newScene) + { + var universe = newScene.IsUniverseScene(); + + OnSceneLoaded?.SafeInvoke(oldScene, newScene, universe); + if (universe) + { + OnUniverseSceneLoaded?.SafeInvoke(oldScene, newScene); + } + } + public static bool IsUniverseScene(this OWScene scene) => scene is OWScene.SolarSystem or OWScene.EyeOfTheUniverse; }