Ejemplo n.º 1
0
    public void GotoScene(string scneneType, Type t = null, Func <SceneBase> func = null, object param = null)
    {
        FairyGUI.GRoot.inst.touchable = false;
        SceneBase scene = GetScnene(scneneType);

        if (func == null)
        {
            func = () =>
            {
                return(Activator.CreateInstance(t) as SceneBase);
            };
        }
        if (scene == null)
        {
            scene           = func();
            scene.SceneName = scneneType;
            mScenes.Add(scneneType, scene);
        }
        if (currentScene != null && scneneType == currentScene.SceneName)
        {
            Debug.LogError("当前场景和要到的目标场景重复" + scneneType);
            currentScene.Enter(param);
        }
        else
        {
            if (currentScene != null)
            {
                currentScene.Leave();
                oldScenes.Enqueue(currentScene);
            }
            currentScene = mScenes[scneneType];
            currentScene.Enter(param);
        }
    }
Ejemplo n.º 2
0
    public void ChangeScene(SceneType sceneType)
    {
        if (m_currentScene != null)
        {
            m_currentScene.Exit();
        }

        m_currentScene = GetScene(sceneType);

        if (m_currentScene != null)
        {
            m_currentScene.Enter();
        }
        m_currentSceneType = sceneType;
    }