Exemple #1
0
 public void Unload(string sceneName, Action onComplete)
 {
     if (AdditiveScenesLoader.TryGetLoadedScene(sceneName, out var scene))
     {
         AdditiveScenesLoader.Unload(scene, onComplete);
     }
     else
     {
         // TODO error and optional param with scene action stack
         onComplete?.Invoke();
     }
 }
Exemple #2
0
 public void Unload(string sceneName, Action onComplete)
 {
     if (AdditiveScenesLoader.TryGetLoadedScene(sceneName, out var scene))
     {
         var sceneDelegate = FindMonoTypeOnSceneRoot <ISceneDelegate>(scene);
         sceneDelegate?.OnSceneUnload();
         AdditiveScenesLoader.Unload(scene, onComplete);
     }
     else
     {
         // TODO error and optional param with scene action stack
         onComplete?.Invoke();
     }
 }
Exemple #3
0
 public void Deactivate <T>(string sceneName, Action <T> onComplete) where T : ISceneManager
 {
     if (AdditiveScenesLoader.TryGetLoadedScene(sceneName, out var scene))
     {
         var sceneManager  = FindMonoTypeOnSceneRoot <T>(scene);
         var sceneDelegate = FindMonoTypeOnSceneRoot <ISceneDelegate>(scene);
         sceneDelegate?.DeactivateScene(() =>
         {
             onComplete?.Invoke(sceneManager);
         });
     }
     else
     {
         throw new InvalidOperationException($"{nameof(SceneLoadService)} can not deactivate {sceneName} scene, because it wasn't loaded. ");
     }
 }
Exemple #4
0
 public void Load <T>(string sceneName, Action <T> onComplete) where T : ISceneManager
 {
     AdditiveScenesLoader.LoadAdditively(sceneName, scene =>
     {
         var sceneManager  = FindMonoTypeOnSceneRoot <T>(scene);
         var sceneDelegate = FindMonoTypeOnSceneRoot <ISceneDelegate>(scene);
         if (sceneDelegate != null)
         {
             sceneDelegate.ActivateScene(() =>
             {
                 onComplete?.Invoke(sceneManager);
             });
         }
         else
         {
             onComplete?.Invoke(sceneManager);
         }
     });
 }
 public void Load <T>(string sceneName, Action <Scene, T> onComplete) where T : ISceneManager
 {
     AdditiveScenesLoader.LoadAdditively(sceneName, loadOperationArgs =>
     {
         if (loadOperationArgs.Status == OperationStatus.Success)
         {
             var sceneManager  = FindMonoTypeOnSceneRoot <T>(loadOperationArgs.Scene);
             var sceneDelegate = FindMonoTypeOnSceneRoot <ISceneDelegate>(loadOperationArgs.Scene);
             if (sceneDelegate != null)
             {
                 sceneDelegate.ActivateScene(() =>
                 {
                     onComplete?.Invoke(loadOperationArgs.Scene, sceneManager);
                 });
             }
             else
             {
                 onComplete?.Invoke(loadOperationArgs.Scene, sceneManager);
             }
         }
         else
         {
             onComplete?.Invoke(default, default);