Browse Source

修复特惠礼包BUG(改过特效加载之后,要先加载特效在播放动效时间轴),优化特惠礼包与限时礼包代码

hexiaojie 2 years ago
parent
commit
25930cfb44

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -157,5 +157,8 @@ namespace GFGGame
         public const string RESET_DAILY_DATA = "RESET_DAILY_DATA";
 
         public const string LUCKY_BOX_FREE_TIME_CHANGED = "LUCKY_BOX_FREE_TIME_CHANGED";
+        
+        //MainView to 同步刷新特惠礼包 限时礼包倒计时
+        public const string LUCKY_BOX_TIME = "LUCKY_BOX_TIME";
     }
 }

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/RushSaleGiftBoxView.cs

@@ -65,6 +65,7 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpViewNone);
+            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_TIME, UpTime);
         }
 
         protected override void RemoveEventListener()
@@ -72,6 +73,7 @@ namespace GFGGame
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpViewNone);
+            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_TIME, UpTime);
             base.RemoveEventListener();
         }
 

+ 5 - 3
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/SpecialOfferGiftBoxView.cs

@@ -52,8 +52,8 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            _ui.m_t0.Play();
             AddEffect();
+            _ui.m_t0.Play();
             InitPageInex();
 
             UpViewNone();
@@ -64,7 +64,8 @@ namespace GFGGame
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
-            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpViewNone);
+            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpViewNone); 
+            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_TIME, UpTime);
         }
 
         protected override void RemoveEventListener()
@@ -72,6 +73,7 @@ namespace GFGGame
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpViewNone);
+            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_TIME, UpTime);
             base.RemoveEventListener();
         }
 
@@ -395,7 +397,7 @@ namespace GFGGame
             _effectUI2 = null;
             EffectUIPool.Recycle(_effectUI3);
             _effectUI3 = null;
-
+           
             DestroyObjectFromView();
 
             this.RemoveEventListener();

+ 1 - 6
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxActivityView.cs

@@ -95,12 +95,7 @@ namespace GFGGame
 
             //=====限时礼包倒计时
             UpGiftBox();
-            if (ViewManager.isViewOpen(nameof(RushSaleGiftBoxView)))
-            {
-                var rushSaleGiftBoxView =
-                    ViewManager.GetUIView(nameof(RushSaleGiftBoxView)) as RushSaleGiftBoxView;
-                rushSaleGiftBoxView?.UpTime();
-            }
+            EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_TIME);
             //=====限时礼包倒计时END
         }
 

+ 1 - 12
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -814,18 +814,7 @@ namespace GFGGame
             //特惠礼包/限时礼包窗口内的倒计时
             UpGiftBox1();
             UpGiftBox2();
-            if (ViewManager.isViewOpen(nameof(SpecialOfferGiftBoxView)))
-            {
-                var specialOfferGiftBoxView =
-                    ViewManager.GetUIView(nameof(SpecialOfferGiftBoxView)) as SpecialOfferGiftBoxView;
-                specialOfferGiftBoxView?.UpTime();
-            }
-            if (ViewManager.isViewOpen(nameof(RushSaleGiftBoxView)))
-            {
-                var rushSaleGiftBoxView =
-                    ViewManager.GetUIView(nameof(RushSaleGiftBoxView)) as RushSaleGiftBoxView;
-                rushSaleGiftBoxView?.UpTime();
-            }
+            EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_TIME);
         }
 
         private void ShowExitAlert()