Example #1
0
        public static void Replace(String nextScene, SceneTransition transition = SceneTransition.FadeOutToBlack_FadeIn, Boolean needFade = true)
        {
            if (nextScene != "MainMenu")
            {
                if (Singleton <BubbleUI> .Instance != null)
                {
                    Singleton <BubbleUI> .Instance.SetGameObjectActive(false);
                }

                EventHUD.Cleanup();
                EventInput.ClearPadMask();
            }

            Instance.Transition = transition;
            if (transition == SceneTransition.SwirlInBlack || transition == SceneTransition.SwirlInWhite)
            {
                PersistenSingleton <UIManager> .Instance.SetPlayerControlEnable(false, null);

                Instance.Swirl(nextScene, transition);
            }
            else
            {
                Instance.NextScene = nextScene;
                SoundLib.LazyLoadSoundResources();
                PersistenSingleton <UIManager> .Instance.SetLoadingForSceneChange();

                Instance.Replace(needFade);
            }
        }
Example #2
0
        public static void ReplaceNow(String nextScene)
        {
            MemoriaExport();

            if (String.IsNullOrEmpty(nextScene))
            {
                Log.Error($"[{nameof(SceneDirector)}] Someone tried to change the current scene [{Instance.CurrentScene}] to the invalid scene: [{nextScene}]. Stack: " + Environment.NewLine + Environment.StackTrace);
            }

            if (nextScene != "MainMenu")
            {
                if (Singleton <BubbleUI> .Instance != (UnityEngine.Object)null)
                {
                    Singleton <BubbleUI> .Instance.SetGameObjectActive(false);
                }
                EventHUD.Cleanup();
                EventInput.ClearPadMask();
            }
            PersistenSingleton <SceneDirector> .Instance.NextScene = nextScene;
            Application.LoadLevel("Loading");
            Resources.UnloadUnusedAssets();
            //GC.Collect();
            PersistenSingleton <SceneDirector> .Instance.LoadNextScene();

            PersistenSingleton <SceneDirector> .Instance.LastScene           = PersistenSingleton <SceneDirector> .Instance.CurrentScene;
            PersistenSingleton <SceneDirector> .Instance.CurrentScene        = PersistenSingleton <SceneDirector> .Instance.NextScene;
            PersistenSingleton <SceneDirector> .Instance.PendingCurrentScene = String.Empty;
            PersistenSingleton <SceneDirector> .Instance.PendingNextScene    = String.Empty;
            PersistenSingleton <SceneDirector> .Instance.NextScene           = String.Empty;
            global::Debug.Log("---------- Current Scene : " + PersistenSingleton <SceneDirector> .Instance.CurrentScene + " ----------");
        }
Example #3
0
        public static void ReplaceNow(String nextScene)
        {
            MemoriaExport();
            if (nextScene != "MainMenu")
            {
                if (Singleton <BubbleUI> .Instance != null)
                {
                    Singleton <BubbleUI> .Instance.SetGameObjectActive(false);
                }
                EventHUD.Cleanup();
                EventInput.ClearPadMask();
            }

            Instance.NextScene = nextScene;
            Application.LoadLevel("Loading");
            Resources.UnloadUnusedAssets();
            GC.Collect();
            Application.LoadLevel(Instance.NextScene);
            Instance.LastScene           = Instance.CurrentScene;
            Instance.CurrentScene        = Instance.NextScene;
            Instance.PendingCurrentScene = String.Empty;
            Instance.PendingNextScene    = String.Empty;
            Instance.NextScene           = String.Empty;
            UnityEngine.Debug.Log("---------- Current Scene : " + Instance.CurrentScene + " ----------");
        }
Example #4
0
        public static void Replace(String nextScene, SceneTransition transition = SceneTransition.FadeOutToBlack_FadeIn, Boolean needFade = true)
        {
            if (String.IsNullOrEmpty(nextScene))
            {
                Log.Error($"[{nameof(SceneDirector)}] Someone tried to change the current scene [{Instance.CurrentScene}] to the invalid scene: [{nextScene}]. Stack: " + Environment.NewLine + Environment.StackTrace);
            }

            if (nextScene != "MainMenu")
            {
                if (Singleton <BubbleUI> .Instance != (UnityEngine.Object)null)
                {
                    Singleton <BubbleUI> .Instance.SetGameObjectActive(false);
                }
                EventHUD.Cleanup();
                EventInput.ClearPadMask();
            }
            PersistenSingleton <SceneDirector> .Instance.Transition = transition;
            if (transition == SceneTransition.SwirlInBlack || transition == SceneTransition.SwirlInWhite)
            {
                PersistenSingleton <UIManager> .Instance.SetPlayerControlEnable(false, (Action)null);

                PersistenSingleton <SceneDirector> .Instance.Swirl(nextScene, transition);

                return;
            }
            PersistenSingleton <SceneDirector> .Instance.NextScene = nextScene;
            SoundLib.LazyLoadSoundResources();
            PersistenSingleton <UIManager> .Instance.SetLoadingForSceneChange();

            PersistenSingleton <SceneDirector> .Instance.Replace(needFade);
        }