Example #1
0
        IEnumerator LoadingSceneAsync(string sceneName)
        {
            yield return(null);

            AsyncOperation async = SceneManager.LoadSceneAsync(sceneName);

            async.allowSceneActivation = false;

            LoadingView view = (LoadingView)UIManager.GetInstance().GetView("LoadingView");

            float displayProgress = 0;
            float realProgress    = 0;

            while (async.progress < 0.9f)
            {
                realProgress = async.progress;

                while (displayProgress < realProgress)
                {
                    displayProgress += 0.01f;
                    view.UpdataProgress(displayProgress);
                    yield return(null);
                }
            }

            realProgress = 1;

            while (displayProgress < realProgress)
            {
                displayProgress += 0.01f;
                view.UpdataProgress(displayProgress);
                yield return(null);
            }

            async.allowSceneActivation = true;
        }