Пример #1
0
    IEnumerator LoadSceneButtonPressActivation(string sceneName)
    {
        AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneName);

        asyncOperation.allowSceneActivation = false;
        if (Time.timeScale == 0)
        {
            Time.timeScale = 1;
        }

        string LoadingProgressString  = Language.LanguageLocator.GetLanguage().GetLoadingText(Language.LoadingText.LOADING_TYPE.LOADING);
        string LoadingCompletedString = Language.LanguageLocator.GetLanguage().GetLoadingText(Language.LoadingText.LOADING_TYPE.TOUCH);

        while (!asyncOperation.isDone)
        {
            loadingText.text = LoadingProgressString + string.Format("\t{0}%", (int)(asyncOperation.progress * 100));
            if (asyncOperation.progress >= 0.9f)
            {
                if (!calledComicAnimation)
                {
                    loadingScreenManager.TextSetupsActivation(false);
                    loadingScreenManager.PlayComicAnimation();
                    calledComicAnimation = true;
                }
                loadingText.text = LoadingCompletedString;
                if (Input.GetMouseButtonDown(0))
                {
                    asyncOperation.allowSceneActivation = true;
                }
            }
            yield return(null);
        }
    }