void Init() { Application.runInBackground = true; QualitySettings.vSyncCount = 0; Application.targetFrameRate = 60; Screen.sleepTimeout = SleepTimeout.NeverSleep; _mainMono = this; _mainGo = this.gameObject; InitManagers(); bool isMain; Scene activeScene = GetActiveScene(out isMain); if (isMain) { LoadScene(_isTestFlow ? "FlowTest_Intro" : StartSceneName); } else { NMScene preLoadScene = GetNMScene(activeScene); LoadScene(preLoadScene._sceneName, preLoadScene); } }
static IEnumerator CoLoadScene(string nextSceneName, NMScene preLoadScene = null) { _useInput = false; _sceneLoadingProgress = 0f; if (null == preLoadScene) { yield return(CoLoad(nextSceneName)); } if (null != _curScene) { _curScene.Exit(); yield return(CoUnLoad()); } Scene _nextScene = SceneManager.GetSceneByName(nextSceneName); _curScene = preLoadScene == null?GetNMScene(_nextScene) : preLoadScene; ReleaseManagers(); LevelManager.Init(_nextScene); yield return(_instance.StartCoroutine(_curScene.PreEnter(_nextScene))); SceneManager.SetActiveScene(SceneManager.GetSceneByName(_curScene._sceneName)); _useInput = true; _curScene.Enter(); }
static NMScene GetNMScene(Scene scene) { NMScene nmScene = null; if (null != scene) { if (scene.name != MainSceneName) { Type sceneType = Type.GetType(SceneNameSpace + scene.name); GameObject newSceneGo = new GameObject(sceneType.Name); nmScene = NMMonoAgent.NMMono.AddMono(newSceneGo, sceneType) as NMScene; nmScene._sceneName = scene.name; } } return(nmScene); }
public static void LoadScene(string nextSceneName, NMScene isPreLoadScene = null) { _instance.StartCoroutine(CoLoadScene(nextSceneName, isPreLoadScene)); }
public static void LoadScene(Type sceneType, NMScene isPreLoadScene = null) { _instance.StartCoroutine(CoLoadScene(sceneType.Name, isPreLoadScene)); }