IEnumerator loadingEndGame(E_SCENE_TYPE sceneType)
    {
        yield return(StartCoroutine(loadingSequenceInitiate()));

        //UIManager.instance.DestroyMainPanel();
        ScenePanelManager.instance.RemovePanel(E_SCENE_TYPE.MAIN);
        UIManager.instance.RemoveAllPanels();
        UIManager.instance.RemoveAllPopups();
        if (GameModeManager.instance != null)
        {
            GameModeManager.instance.DestroyGame();
        }
        else
        {
            Destroy(InGameTopPlace.instance.gameObject);
        }

        if (PvpManager.instance != null)
        {
            PvpManager.instance.DestroyGame();
        }
        else
        {
            Destroy(InGameTopPlace.instance.gameObject);
        }

        yield return(StartCoroutine(loadingScene(sceneType)));

        yield return(StartCoroutine(loadingSequenceComplete()));
    }
    E_SCENE_TYPE findSceneType(string sceneTypeName)
    {
        E_SCENE_TYPE sceneType = E_SCENE_TYPE.START;

        if (true == sceneTypeName.Equals("PATCH"))
        {
            sceneType = E_SCENE_TYPE.PATCH;
        }
        else if (true == sceneTypeName.Equals("MAIN"))
        {
            sceneType = E_SCENE_TYPE.MAIN;
        }
        else if (true == sceneTypeName.Equals("SINGLE"))
        {
            sceneType = E_SCENE_TYPE.SINGLE;
        }
        else if (true == sceneTypeName.Equals("PVP"))
        {
            sceneType = E_SCENE_TYPE.PVP;
        }
        else if (true == sceneTypeName.Equals("RAID"))
        {
            sceneType = E_SCENE_TYPE.RAID;
        }

        return(sceneType);
    }
    IEnumerator loadingScene(E_SCENE_TYPE sceneType)
    {
        yield return(new WaitForEndOfFrame());

        string sceneName = findSceneName(sceneType);

        _operator = Application.LoadLevelAsync(sceneName);
        _operator.allowSceneActivation = false;

        //Scene Loading.
        while (!_operator.isDone)
        {
            if (_operator.progress >= 0.9f)
            {
                //_loadPanel.GetComponent<SceneLoadingPanel>().SetLoadGauge(0);
                //_loadPanel.transform.GetComponent<tk2dUIProgressBar>().Value = 1.0f;
                break;
            }
            else
            {
                //_loadPanel.GetComponent<SceneLoadingPanel>().SetLoadGauge( (int)(_operator.progress * 10));
                //_loadPanel.transform.GetComponent<tk2dUIProgressBar>().Value = _operator.progress;

                yield return(null);
            }
        }


        _operator.allowSceneActivation = true;

        yield return(new WaitForEndOfFrame());
    }
    IEnumerator loadingSequenceStart(E_SCENE_TYPE sceneType)
    {
        yield return(StartCoroutine(loadingSequenceInitiate()));

        yield return(StartCoroutine(loadingScene(sceneType)));

        yield return(StartCoroutine(loadingSequenceComplete()));
    }
    public void LoadScene(E_SCENE_TYPE _sceneType, string _roomName)
    {
        if (m_currentMain != null)
        {
            m_currentMain.ExitSceneInit();
        }

        m_NextRoomName = _roomName;
        m_NextRoomType = _sceneType;
        SceneManager.LoadScene("scene_Loading", LoadSceneMode.Single);

        // StartCoroutine(LoadScene_C(_sceneType));
    }
    string findSceneName(E_SCENE_TYPE sceneType)
    {
        string sceneName = "";

        switch (sceneType)
        {
        case E_SCENE_TYPE.START:
        {
            break;
        }

        case E_SCENE_TYPE.PATCH:
        {
            sceneName = "2.Patch";
            break;
        }

        case E_SCENE_TYPE.MAIN:
        {
            sceneName = "3.Main";
            break;
        }

        case E_SCENE_TYPE.SINGLE:
        {
            sceneName = "4.Single";
            break;
        }

        case E_SCENE_TYPE.PVP:
        {
            sceneName = "5.PvP";
            break;
        }

        case E_SCENE_TYPE.RAID:
        {
            sceneName = "6.Raid";
            break;
        }

        default:
        {
            break;
        }
        }

        return(sceneName);
    }
    public void StartLoading(string sceneTypeName)
    {
        StopAllCoroutines();

        E_SCENE_TYPE sceneType = E_SCENE_TYPE.START;

        sceneType = findSceneType(sceneTypeName);

        if (E_SCENE_TYPE.START == sceneType)
        {
            return;
        }

        StartCoroutine(loadingSequenceStart(sceneType));
    }
    public void GameEnd()
    {
        StartLoading();
        StopAllCoroutines();

        E_SCENE_TYPE sceneType = E_SCENE_TYPE.START;

        sceneType = findSceneType(E_SCENE_TYPE.MAIN.ToString());

        if (E_SCENE_TYPE.START == sceneType)
        {
            return;
        }

        StartCoroutine(loadingEndGame(sceneType));
    }
    IEnumerator LoadScene_C(E_SCENE_TYPE _sceneType)
    {
        yield return(new WaitForSeconds(4.0f));

        Debug.Log(_sceneType.ToString() + " Try to loading Scene");

        string         sceneName = Common.GetSceneName(_sceneType);
        AsyncOperation Op        = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);

        Op.allowSceneActivation = false;

        while (!Op.isDone)
        {
            yield return(null);

            Debug.Log(sceneName.ToString() + " Loading...");
            if (Op.progress >= 0.9f)
            {
                m_sceneType = _sceneType;

                Op.allowSceneActivation = true;
            }
        }
    }
Exemple #10
0
    static public string GetSceneName(E_SCENE_TYPE _sceneType)
    {
        string sceneName = "scene_" + _sceneType.ToString();

        return(sceneName);
    }