zhaoyang 2 жил өмнө
parent
commit
e554918e96

+ 22 - 13
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxBonusView.cs

@@ -2,6 +2,7 @@ using UnityEngine;
 using FairyGUI;
 using UI.LuckyBox;
 using System.Collections.Generic;
+using System.Collections;
 
 namespace GFGGame
 {
@@ -85,15 +86,11 @@ namespace GFGGame
         protected override void OnHide()
         {
             base.OnHide();
-            // _ui.m_grpItems.visible = false;
-            // _ui.m_itemOne.target.visible = false;
             _ui.m_t1.Play();
             openCount = 0;
-            // openIndex = 0;
             newCardList.Clear();
             newItemList.Clear();
             itemList.Clear();
-            Timers.inst.Remove(UpdateTime);
             for (int i = 0; i < openState.Count; i++)
             {
                 openState[i] = false;
@@ -293,26 +290,38 @@ namespace GFGGame
             }
             else
             {
-                Timers.inst.Add(0.3f, openState.Count - openCount, UpdateTime);
+                // Timers.inst.Add(0.3f, openState.Count - openCount, UpdateTime);
+                Timers.inst.StartCoroutine(UpdatePass());
             }
         }
-        private void UpdateTime(object param)
+        public IEnumerator UpdatePass()
         {
-            int index = 0;
-            GComponent component = null;
             for (int i = 0; i < openState.Count; i++)
             {
                 if (openState[i] == false)
                 {
-                    index = i;
-                    component = _ui.target.GetChild("item" + i).asCom;
-                    break;
+                    yield return new WaitForSeconds(0.3f);
+                    yield return UpdateTime(i);
                 }
             }
+        }
+        private IEnumerator UpdateTime(int index)
+        {
+            // int index = 0;
+            // GComponent component = null;
+            // for (int i = 0; i < openState.Count; i++)
+            // {
+            //     if (openState[i] == false)
+            //     {
+            //         index = i;
+            GComponent component = _ui.target.GetChild("item" + index).asCom;
+            //         break;
+            //     }
+            // }
             Transition transition = component.GetTransition("t1");
             GComponent comIcon = component.GetChild("comIcon").asCom;
             GImage imgNew = comIcon.GetChild("imgNew").asImage;
-            if (transition.playing || comIcon.skew == Vector2.zero) return;
+            // if (transition.playing || comIcon.skew == Vector2.zero) return;
             openCount++;
             openState[index] = true;
             if (imgNew.visible)
@@ -339,7 +348,7 @@ namespace GFGGame
                 _gameobjects[index].SetActive(true);
                 transition.Play();
             }
-
+            yield return null;
         }
         private void PlayComplete()
         {