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 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);
        }