예제 #1
0
    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));
    }
예제 #2
0
    protected void AddPage(SceneBase scene)
    {
        if (scene == null)
        {
            return;
        }

        m_pages.Add(new KeyValuePair<string, SceneBase>(scene.GetType().ToString(), scene));
    }
예제 #3
0
    public static void Destroy(SceneBase scene)
    {
        var sceneName = scene.GetType().Name;

        if (_instances.ContainsKey(sceneName))
        {
            _instances.Remove(sceneName);
        }
        GameObject.Destroy(scene);
    }