Exemple #1
0
    private void OnBtnMenu(GameObject obj)
    {
        //UIPanelManager.Instance.showUI(EUiId.ID_LoadingPanel1);
        //LoadSceneHelper.Instance.loadScene("MyBoxStart", delegate
        //{
        //    UIPanelManager.Instance.hideUI(EUiId.ID_LoadingPanel1);
        //    UIPanelManager.Instance.showUI(EUiId.ID_MenuPanel);
        //});
        UIPanelManager.Instance.hideUI(this.id);
        UtilUI.clearMemory();
        GameObject uiRoot = GameObject.FindGameObjectWithTag("UIRoot");

        Destroy(uiRoot);
        SceneManager.LoadScene("MyBoxStart");
    }
Exemple #2
0
    void Update()
    {
        if (asyn == null)
        {
            return;
        }
        int trueProgress = 0;

        if (asyn.progress < 0.9f)//异步加载场景的进度值
        {
            trueProgress = (int)asyn.progress * 100;
        }
        else
        {
            trueProgress = 100;
        }

        if (curLoadedValue < trueProgress)
        {
            curLoadedValue++;
        }
        imgLoading.fillAmount = curLoadedValue / 100f; //把百分比赋值给图片
        txtValue.text         = curLoadedValue + "%";  //赋值给文字
        if (curLoadedValue >= 100)
        {
            txtValue.text             = "生成世界中,请稍候";
            asyn.allowSceneActivation = true;
        }
        if (asyn.isDone)
        {
            if (actionAfterLoadScene != null)
            {
                actionAfterLoadScene();
            }
            imgLoading.fillAmount = 0.0f;
            asyn = null;
            UtilUI.clearMemory();
            this.gameObject.SetActive(false);
        }
    }