Example #1
0
    /// <summary>
    /// 将当前场景入栈,并加载新场景
    /// </summary>
    /// <param name="next">待加载的场景</param>
    public void PushScene(SceneBase next)
    {
        if (next == null)
        {
            Debug.LogWarning("SceneManager.PushScene : Null GameScene.");
            return;
        }

        if (currentScene != null)
        {
            if (currentScene.SNode == next.SNode)
            {
                Debug.LogWarning("SceneManager.PushScene : The Same GameScene.");
                return;
            }

            currentScene.OnPushed(next);
            sceneStack.AddLast(currentScene);
        }

        next.LoadScene();
        next.UpdateAudioState();
        next.UpdateGlobalLight();
        currentScene = next;
    }