public void Transition<T>(string resourceName, float fadeInDuration, float fadeOutDuration, System.Action<eSceneTransitionErrorCode> completed) where T : SceneBase { if (m_transitionCoroutine != null) { return; } // check resource UnityEngine.SceneManagement.Scene activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); if (activeScene.name.Equals(resourceName, System.StringComparison.CurrentCultureIgnoreCase) == true) { resourceName = string.Empty; } // check page if (m_currentScene != null) { if (m_currentScene.GetType() == typeof(T)) { completed(eSceneTransitionErrorCode.Failure); return; } } m_transitionCoroutine = Setting.StartCoroutine(OnTransitionCoroutine<T>(resourceName, fadeInDuration, fadeOutDuration, completed)); }
protected void AddPage(SceneBase scene) { if (scene == null) { return; } m_pages.Add(new KeyValuePair<string, SceneBase>(scene.GetType().ToString(), scene)); }
public static void Destroy(SceneBase scene) { var sceneName = scene.GetType().Name; if (_instances.ContainsKey(sceneName)) { _instances.Remove(sceneName); } GameObject.Destroy(scene); }