Esempio n. 1
0
    IEnumerator LoadScene(string scene, int timeWait)
    {
        yield return(new WaitForSeconds(timeWait));

        if (!SwitchManually)
        {
            StartCoroutine(SceneTool.LoadSceneAsyncSwitch(scene));
        }
        else
        {
            StartCoroutine(SceneTool.LoadSceneAsync(scene, UnityEngine.SceneManagement.LoadSceneMode.Single));

            yield return(new WaitUntil(() => SceneTool.LoadingDone));

            SpinnerGO.SetActive(false);

            manuallySwitchText.SetActive(true);

            if (tipsManager)
            {
                tipsManager.TipsText.gameObject.SetActive(false);
            }

            yield return(new WaitUntil(() => Input.anyKey));

            if (!fadeController)
            {
                if (MainCamera != null)
                {
                    Destroy(MainCamera);
                }

                SceneTool.AllowSceneActivation();
            }
            else
            {
                fadeController.FadeInPanel();
                yield return(new WaitUntil(() => !fadeController.isFading()));

                if (MainCamera != null)
                {
                    Destroy(MainCamera);
                }

                SceneTool.AllowSceneActivation();
            }
        }
    }
Esempio n. 2
0
    IEnumerator LoadScene(string scene, int timeWait)
    {
        yield return(new WaitForSeconds(timeWait));

        if (!SwitchManually)
        {
            StartCoroutine(SceneTool.LoadSceneAsyncSwitch(scene));
        }
        else
        {
            StartCoroutine(SceneTool.LoadSceneAsync(scene));

            yield return(new WaitUntil(() => SceneTool.LoadingDone));

            SpinnerGO.transform.parent.gameObject.SetActive(false);

            manuallySwitchText.SetActive(true);

            if (tipsManager)
            {
                tipsManager.TipsText.gameObject.SetActive(false);
            }

            yield return(new WaitUntil(() => Input.anyKey));

            if (!fadeControler)
            {
                SceneTool.AllowSceneActivation();
            }
            else
            {
                fadeControler.FadeInPanel();
                yield return(new WaitUntil(() => !fadeControler.isFading()));

                SceneTool.AllowSceneActivation();
            }
        }
    }