少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-01 c90cdd78c2bf8bcfa25cec7432a5876f6085ecfb
System/Loading/LoadingWin.cs
@@ -41,6 +41,8 @@
        float refProgress = 0f;
        float expectDuration = 5f;
        float overTimer = 0f;
        LoadingType loadingType = LoadingType.Normal;
        #region Built-in
@@ -54,6 +56,8 @@
        protected override void OnPreOpen()
        {
            overTimer = 0f;
            refProgress = 0f;
            var useDefautBackGround = false;
            if (!AssetSource.uiFromEditor)
            {
@@ -195,8 +199,7 @@
                else
                {
                    m_ContainerProgress.gameObject.SetActive(true);
                    m_ProgressSlider.value = refProgress = 0f;
                    StageManager.Instance.loadingProgressEvent += UpdateLoadingProgress;
                    m_ProgressSlider.ResetValue(0f);
                }
            }
@@ -208,8 +211,6 @@
        protected override void OnPreClose()
        {
            StageManager.Instance.loadingProgressEvent -= UpdateLoadingProgress;
            if (!AssetSource.uiFromEditor)
            {
                AssetBundleUtility.Instance.UnloadAssetBundle("ui/sprite/loading", true, false);
@@ -222,21 +223,31 @@
        }
        #endregion
        protected override void LateUpdate()
        {
            base.LateUpdate();
            if (loadingType == LoadingType.Normal)
            {
                refProgress = Mathf.Clamp01(refProgress + Time.deltaTime / expectDuration);
                if (StageLoad.Instance.progress + 0.1f > refProgress)
                {
                    refProgress = Mathf.Clamp01(StageLoad.Instance.progress + 0.1f);
                }
                m_ProgressSlider.value = refProgress;
            }
        }
        void UpdateLoadingProgress(float _progress)
        {
            m_ProgressSlider.value = refProgress = Mathf.Max(_progress, refProgress);
            overTimer += Time.deltaTime;
            if (overTimer > 15f)
            {
                overTimer -= 5f;
                var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
                if (!loginModel.busy && !CrossServerLogin.Instance.busy && !StageLoad.Instance.isLoading)
                {
                    WindowCenter.Instance.Close<LoadingWin>();
                }
            }
        }
        private List<int> GetShowFunctions(int _level)