Prechádzať zdrojové kódy

进度界面可以设置速度

guodong 1 rok pred
rodič
commit
d94e6e00da

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -250,7 +250,7 @@ namespace GFGGame
             }
             ViewManager.Hide<ModalStatusView>();
             ViewManager.Hide<LoginView>();
-            ViewManager.Show<LoadingView>();
+            ViewManager.Show<LoadingView>(0.01f);
             LoadingView.Instance.SetProgress(99);
             LoadingView.Instance.SetDesc("正在加载数据...");
             LogServerHelper.SendNodeLog((int)LogNode.StartEnterGame);

+ 13 - 3
GameClient/Assets/Game/HotUpdate/Views/Loading/LoadingView.cs

@@ -8,11 +8,13 @@ namespace GFGGame
     {
 
         private UI_LoadingView _ui;
-
-        private const float SPEED = 0.005f;
+        //每个进度需要的时间,单位为毫秒
+        private const float TimePerProgress = 0.005f;
         private string[] resNames = { "11", "33" };
 
         private EffectUI _effectUI1;
+        //每个进度需要的时间,单位为毫秒
+        private float timePerProgress;
 
         private static LoadingView m_Instance = null;
 
@@ -57,6 +59,14 @@ namespace GFGGame
         {
             base.OnShown();//1;//
             SetProgress(0);
+            if(this.viewData != null)
+            {
+                timePerProgress = (float)this.viewData;
+            }
+            else
+            {
+                timePerProgress = TimePerProgress;
+            }
             int index = Random.Range(0, resNames.Length);
             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath(resNames[index]);
 
@@ -113,7 +123,7 @@ namespace GFGGame
             }
             else
             {
-                float duration = (float)(progress - oldValule) * SPEED;
+                float duration = (float)(progress - oldValule) * timePerProgress;
                 GTweener gtweener = _ui.m_progressBar1.TweenValue(progress, duration).OnUpdate((GTweener t) =>
                 {
                     float posX = _ui.m_progressBar1.width * (t.value.x / 100) + _ui.m_progressBar1.x;