소스 검색

限时礼包

何晓捷 2 년 전
부모
커밋
ee3ccc38b0

+ 14 - 1
FGUIProject/assets/Main/MainUI.xml

@@ -100,9 +100,22 @@
     <graph id="n71_mzf8" name="n71" xy="0,0" size="1080,1920" alpha="0" touchable="false" type="rect" lineSize="0">
       <relation target="" sidePair="width-width,height-height"/>
     </graph>
-    <component id="n79_g1yr" name="btnFirstRecharge" src="qik1tm1" fileName="components/BtnStyle000.xml" pkg="eg2y0ldp" xy="423,223">
+    <component id="n79_g1yr" name="btnFirstRecharge" src="qik1tm1" fileName="components/BtnStyle000.xml" pkg="eg2y0ldp" xy="423,223" group="n88_ktf2">
       <Button title="首充"/>
     </component>
+    <component id="n80_ktf2" name="btnGiftBag1" src="ktf2o5" fileName="components/Button5.xml" xy="649,205" group="n83_ktf2">
+      <Button icon="ui://mfvz4q8kktf2o7"/>
+    </component>
+    <image id="n81_ktf2" name="n81" src="ktf2o8" fileName="images/cj_sj_db.png" xy="632,285" size="128,32" group="n83_ktf2"/>
+    <text id="n82_ktf2" name="txtGiftBagTime1" xy="646,280" pivot="0.5,0" size="100,39" group="n83_ktf2" fontSize="28" color="#fffbf9" align="center" text="03:23:45"/>
+    <group id="n83_ktf2" name="n83" xy="632,205" size="128,114" group="n88_ktf2" advanced="true"/>
+    <component id="n84_ktf2" name="btnGiftBag2" src="ktf2o5" fileName="components/Button5.xml" xy="782,207" group="n87_ktf2">
+      <Button icon="ui://mfvz4q8kktf2o7"/>
+    </component>
+    <image id="n85_ktf2" name="n85" src="ktf2o8" fileName="images/cj_sj_db.png" xy="765,287" size="128,32" group="n87_ktf2"/>
+    <text id="n86_ktf2" name="txtGiftBagTime2" xy="779,282" pivot="0.5,0" size="100,39" group="n87_ktf2" fontSize="28" color="#fffbf9" align="center" text="03:23:45"/>
+    <group id="n87_ktf2" name="n87" xy="765,207" size="128,114" group="n88_ktf2" advanced="true"/>
+    <group id="n88_ktf2" name="n88" xy="423,205" size="470,116"/>
   </displayList>
   <transition name="t1">
     <item time="0" type="Alpha" target="n71_mzf8" tween="true" startValue="0" endValue="1" duration="10" ease="Linear"/>

+ 4 - 0
FGUIProject/assets/Main/package.xml

@@ -617,6 +617,10 @@
     <image id="9jv6o2" name="3Second.png" path="/imagesNew/"/>
     <component id="fqoro3" name="ComResultProMask.xml" path="/components/"/>
     <component id="mbf1o4" name="Button4.xml" path="/components/"/>
+    <component id="ktf2o5" name="Button5.xml" path="/components/"/>
+    <image id="ktf2o6" name="cj_yulan.png" path="/images/"/>
+    <image id="ktf2o7" name="cj_meirith.png" path="/images/"/>
+    <image id="ktf2o8" name="cj_sj_db.png" path="/images/"/>
   </resources>
   <publish name="" path="../GameClient/Assets/ResIn/UI/Main" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

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

@@ -129,11 +129,5 @@ namespace GFGGame
         public const string ACTIVITY_REMOVE = "ACTIVITY_REMOVE";
         //通知活动添加
         public const string ACTIVITY_ADD = "ACTIVITY_ADD";
-        
-        //活动界面时间同步限时抢购
-        public const string LUCKY_BOX_ACTIVITY_TIMERS = "LUCKY_BOX_ACTIVITY_TIMERS";
-        
-        //主界面同步时间到限时特惠
-        public const string MAIN_SYNC_TIME_TO_GIFTBOX = "MAIN_SYNC_TIME_TO_GIFTBOX";
     }
 }

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

@@ -51,6 +51,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
+            _type = (int)(this.viewData as object[])[0]; //ConstActivityType
             AddEffect();
             InitPageInex();
 
@@ -60,14 +61,12 @@ namespace GFGGame
         protected override void AddEventListener()
         {
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
         }
 
         protected override void RemoveEventListener()
         {
-            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             base.RemoveEventListener();
@@ -96,7 +95,7 @@ namespace GFGGame
             }
         }
 
-        private void UpTime()
+        public void UpTime()
         {
             //筛选一条数据用来界面渲染
             var list = _type == ConstActivityType.ActLimitGiftYxByLevel

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

@@ -55,14 +55,12 @@ namespace GFGGame
         protected override void AddEventListener()
         {
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
         }
 
         protected override void RemoveEventListener()
         {
-            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             base.RemoveEventListener();
@@ -72,7 +70,7 @@ namespace GFGGame
         {
         }
 
-        private void UpTime()
+        public void UpTime()
         {
             //筛选一条数据用来界面渲染
             var list = LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData3;

+ 43 - 4
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxActivityView.cs

@@ -3,6 +3,7 @@ using UI.LuckyBox;
 using UI.CommonGame;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using UnityEngine;
 using ET;
 
@@ -85,11 +86,18 @@ namespace GFGGame
             }
             TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
             _ui.m_txtTime.text = TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime);
-            
-            //限时礼包窗口内的倒计时
-            EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS);
-        }
 
+            //=====限时礼包倒计时
+            UpGiftBox();
+            if (ViewManager.isViewOpen(typeof(RushSaleGiftBoxView).FullName))
+            {
+                var rushSaleGiftBoxView =
+                    ViewManager.GetUIView(typeof(RushSaleGiftBoxView).FullName) as RushSaleGiftBoxView;
+                rushSaleGiftBoxView?.UpTime();
+            }
+            //=====限时礼包倒计时END
+        }
+        
         private void UpdateView()
         {
             _ui.m_txtCount.SetVar("value", ActivityDataManager.Instance.lastDrawCount.ToString()).FlushVars();
@@ -132,6 +140,23 @@ namespace GFGGame
 
             UI_ComBox_4.ProxyEnd();
         }
+        
+        private void UpGiftBox()
+        {
+            var activityInfoByTypeList =
+                ActivityGlobalDataManager.Instance.GetActivityInfoByType(ConstActivityType.ActLimitGiftYxByTime);
+
+            var list = activityInfoByTypeList
+                .Where(a => a.endTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                _ui.m_txtGiftBagTime.text = "已结束";
+            }
+            else
+            {
+                _ui.m_txtGiftBagTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].endTime);
+            }
+        }
 
         private void OnClickBtnPreview(EventContext context)
         {
@@ -188,9 +213,23 @@ namespace GFGGame
         {
             ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_GIFT_BAG, ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY });
         }
+        
+        //限时礼包按钮点击执行方法
         private void OnClikcBtnGiftBag()
         {
+            var activityInfoByTypeList =
+                ActivityGlobalDataManager.Instance.GetActivityInfoByType(ConstActivityType.ActLimitGiftYxByTime);
 
+            var list = activityInfoByTypeList
+                .Where(a => a.endTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("活动已结束");
+            }
+            else
+            {
+                ViewManager.Show<RushSaleGiftBoxView>(new object[] { ConstActivityType.ActLimitGiftYxByTime, this.viewData });
+            }
         }
 
         protected override void OnHide()

+ 8 - 2
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -663,8 +663,14 @@ namespace GFGGame
             {
                 _ui.m_btnActivityDay7.visible = false;
             }
-            //特惠礼包窗口内的倒计时
-            EventAgent.DispatchEvent(ConstMessage.MAIN_SYNC_TIME_TO_GIFTBOX);
+
+            //特惠礼包/限时礼包窗口内的倒计时
+            if (ViewManager.isViewOpen(typeof(SpecialOfferGiftBoxView).FullName))
+            {
+                var specialOfferGiftBoxView =
+                    ViewManager.GetUIView(typeof(SpecialOfferGiftBoxView).FullName) as SpecialOfferGiftBoxView;
+                specialOfferGiftBoxView?.UpTime();
+            }
         }
 
         private void ShowExitAlert()