Beispiel #1
0
    /// <summary>
    /// 弹出栈顶场景,并将当前场景销毁
    /// </summary>
    public void PopScene()
    {
        if (sceneStack.Count <= 0 || sceneStack.Last == null)
        {
            return;
        }

        SceneBase last    = currentScene;
        SceneBase bePoped = sceneStack.Last.Value;

        if (currentScene != null)
        {
            currentScene.OnDestroy();
        }

        if (bePoped != null)
        {
            bePoped.OnPoped(last);

            bePoped.LoadScene();
            bePoped.UpdateAudioState();
            bePoped.UpdateGlobalLight();

            currentScene = bePoped;
        }

        sceneStack.RemoveLast();
    }
Beispiel #2
0
    // 开始切换场景
    public static void StartGoToScene(SceneEnum state)
    {
        if (m_CurrentScene != null)
        {
            m_CurrentScene.OnDestroy();
            m_CurrentScene = null;
        }

        if (!SceneDic.ContainsKey(state))
        {
            Debug.LogError("SceneState is null : " + state);
            return;
        }

        SceneDic[state].StartLoading();
    }
Beispiel #3
0
    public void OnHanderEvent(EventData data)
    {
        if (data.name == ChangeSceneFinished)
        {
            while (oldScenes.Count > 0)
            {
                SceneBase scene = oldScenes.Dequeue();

                scene.OnDestroy();
                if (mScenes.ContainsKey(scene.SceneName))
                {
                    mScenes.Remove(scene.SceneName);
                }
            }
            //FairyGUI.GRoot.inst.CloseModalWait();
            ResMgr.Intstance.UnLoadAll();
        }
    }