示例#1
0
    public void SetState(AppState state)
    {
        if (state == curState)
        {
            return;
        }

        LogMgr.I("AppMgr", "SetState", "状态切换到:" + state, true);

        preState = curState;

        StateExit(preState);

        curState = state;

        switch (curState)
        {
        case AppState.mainMenu:
            break;

        case AppState.stageScn:
            //StageScnMgr.Create();
            break;

        case AppState.gameScn:
            break;

        case AppState.loading:
            UILoadingWindow.Create();
            break;
        }
    }
示例#2
0
    IEnumerator LoadSceneAsyncIE(int levelId, Action onComplete)
    {
        string     levelName = "Level_" + levelId;
        bool       complete  = false;
        UICallBack callback  = (objs) =>
        {
            complete = true;
        };
        UILoadingWindow loadingWindow = UIManager.Instance.OpenWindow <UILoadingWindow>(true, callback);

        while (!complete)
        {
            yield return(null);
        }
        var asyncOperation = SceneManager.LoadSceneAsync(levelName);

        asyncOperation.completed           += (op) => { onComplete?.Invoke(); };
        asyncOperation.allowSceneActivation = false;
        while (asyncOperation.progress < 0.9f)
        {
            loadingWindow.SetProgress(asyncOperation.progress / 9 * 10);
            yield return(null);
        }
        loadingWindow.SetProgress(1);
        while (loadingWindow.Progress < 1)
        {
            yield return(null);
        }
        yield return(new WaitForSeconds(LoadCompleteDelay));

        UIManager.Instance.CloseWindow(loadingWindow);
        asyncOperation.allowSceneActivation = true;
        GameManager.CurLevelId = levelId;
    }
示例#3
0
    /// <summary>
    /// 进入主场景
    /// </summary>
    public void SwitchToMain(bool loading = true, Callback callback = null)
    {
//#if CHAPTER_ONE
//        if (loading && !ConfigDataMgr.instance.gameConfig.ios_audit)
//#elif CHAPTER_TWO
        if (loading)
//#endif
        {
            UILoadingWindow uiLoadingWindow = UIManager.Instance.OpenUI <UILoadingWindow>();
            AsyncOperation  async           = SceneManager.LoadSceneAsync(MainScene);
            uiLoadingWindow.InitWith(async, () =>
            {
                UIManager.Instance.OpenUI <UIMainWindow>();

                if (callback != null)
                {
                    callback();
                }
            });
        }
        else
        {
            SceneManager.LoadScene(MainScene);

            UIManager.Instance.OpenUI <UIMainWindow>();
            if (callback != null)
            {
                callback();
            }
        }
    }
示例#4
0
    public void SwitchToExam()
    {
        AsyncOperation  async           = SceneManager.LoadSceneAsync("ExamScene");
        UILoadingWindow uiLoadingWindow = UIManager.Instance.OpenUI <UILoadingWindow>();

        uiLoadingWindow.InitWith(async);
    }
示例#5
0
    void StateExit(AppState preState)
    {
        switch (curState)
        {
        case AppState.mainMenu:
            break;

        case AppState.stageScn:
            break;

        case AppState.gameScn:
            break;

        case AppState.loading:
            UILoadingWindow.Close();
            break;
        }
    }