Vue父组件中调子组件样式没有反应的解决方法

背包题目汇总

  返回  

unity异步加载

2021/8/20 16:57:41 浏览:
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;

public class GotoSceneForAsyncOperation : MonoBehaviour
{
    public GameObject loadScene;

    public Slider loadSlider;

    public Text showText;

    public void LoadNextScene()
    {
        StartCoroutine(Loadlevel());
    }

    IEnumerator Loadlevel()
    {
        loadScene.SetActive(true);
        AsyncOperation operation = SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1);
        operation.allowSceneActivation = false;

        while (!operation.isDone)
        {
            loadSlider.value = operation.progress;
            showText.text = operation.progress * 100 + "%";
            if (operation.progress >= 0.9f)
            {
                loadSlider.value = 1;
                showText.text = "Pls enter any keys~";
                if (Input.anyKeyDown)
                {
                    operation.allowSceneActivation = true;
                }
            }
            yield return null;
        }
    }
}

联系我们

如果您对我们的服务有兴趣,请及时和我们联系!

服务热线:18288888888
座机:18288888888
传真:
邮箱:888888@qq.com
地址:郑州市文化路红专路93号