Browse Source

限时礼包-跑通

何晓捷 2 years ago
parent
commit
3e72681deb

+ 17 - 17
FGUIProject/assets/EnduringGiftBox/RushSaleGiftBoxUI.xml

@@ -1,24 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="1080,1231">
+<component size="1080,958">
   <displayList>
-    <image id="n1_yjmk" name="n1" src="yjmk2j" fileName="images/xsqg_db.png" xy="1,0"/>
-    <image id="n0_yjmk" name="n0" src="yjmk2l" fileName="images/xsqg_lihui.png" xy="44,95"/>
-    <image id="n2_yjmk" name="n2" src="yjmk2i" fileName="images/wz_xsqg.png" xy="335,98"/>
-    <image id="n5_yjmk" name="n5" src="yjmk2m" fileName="images/xsqg_nr_db.png" xy="193,287"/>
-    <text id="n4_yjmk" name="txtBoxItemName" xy="363,279" size="283,65" fontSize="40" color="#fffbf5" align="center" autoSize="none" strokeColor="#d69546" text="体力限时礼包"/>
-    <image id="n6_yjmk" name="n6" src="yjmk2n" fileName="images/xsqg_sj_db.png" xy="639,288"/>
-    <text id="n8_yjmk" name="txtBoxResidueTime" xy="683,286" size="207,48" fontSize="35" color="#fffbf5" align="center" autoSize="none" text="6天23分23秒"/>
-    <list id="n11_yjmk" name="list" xy="344,449" size="425,203" layout="flow_vt" overflow="scroll" scroll="horizontal" colGap="50" defaultItem="ui://bdi1qe15yjmk2p" align="center">
+    <image id="n1_yjmk" name="n1" src="yjmk2j" fileName="images/xsqg_db.png" xy="1,-72"/>
+    <image id="n0_yjmk" name="n0" src="yjmk2l" fileName="images/xsqg_lihui.png" xy="44,23"/>
+    <image id="n2_yjmk" name="n2" src="yjmk2i" fileName="images/wz_xsqg.png" xy="335,26"/>
+    <image id="n5_yjmk" name="n5" src="yjmk2m" fileName="images/xsqg_nr_db.png" xy="193,215"/>
+    <text id="n4_yjmk" name="txtBoxItemName" xy="363,207" size="283,65" fontSize="40" color="#fffbf5" align="center" autoSize="none" strokeColor="#d69546" text="体力限时礼包"/>
+    <image id="n6_yjmk" name="n6" src="yjmk2n" fileName="images/xsqg_sj_db.png" xy="639,216"/>
+    <text id="n8_yjmk" name="txtBoxResidueTime" xy="683,214" size="207,48" fontSize="35" color="#fffbf5" align="center" autoSize="none" text="6天23分23秒"/>
+    <list id="n11_yjmk" name="list" xy="344,377" size="425,203" layout="flow_vt" overflow="scroll" scroll="horizontal" colGap="50" defaultItem="ui://bdi1qe15yjmk2p" align="center">
       <item/>
       <item/>
     </list>
-    <image id="n12_yjmk" name="n12" src="yjmk2b" fileName="images/xsqg_zsx.png" xy="302,674"/>
-    <text id="n13_yjmk" name="txtUrc" xy="453,695" size="224,68" fontSize="34" color="#b8857b" align="center" vAlign="middle" autoSize="shrink" text="今日限购0/1"/>
-    <component id="n15_yjmk" name="btnBuyPink" src="yjmk2q" fileName="components/BtnBuyPink.xml" xy="408,765"/>
-    <component id="n14_yjmk" name="comDiscount" src="yjmk2r" fileName="components/ComDiscount2.xml" xy="333,714"/>
-    <text id="n16_yjmk" name="txtLrc" xy="379,859" size="380,46" fontSize="34" color="#b8857b" align="center" autoSize="shrink" text="可获得60充值经验"/>
-    <component id="n19_droi" name="btnUp" src="droi3c" fileName="components/BtnUp.xml" xy="63,452"/>
-    <component id="n20_droi" name="btnNext" src="droi3d" fileName="components/BtnNext.xml" xy="877,458"/>
-    <component id="n21_droi" name="btnBack" src="qqhz26" fileName="components/BnBack.xml" xy="502,1014"/>
+    <image id="n12_yjmk" name="n12" src="yjmk2b" fileName="images/xsqg_zsx.png" xy="302,602"/>
+    <text id="n13_yjmk" name="txtUrc" xy="453,623" size="224,68" fontSize="34" color="#b8857b" align="center" vAlign="middle" autoSize="shrink" text="今日限购0/1"/>
+    <component id="n15_yjmk" name="btnBuyPink" src="yjmk2q" fileName="components/BtnBuyPink.xml" xy="408,693"/>
+    <component id="n14_yjmk" name="comDiscount" src="yjmk2r" fileName="components/ComDiscount2.xml" xy="333,642"/>
+    <text id="n16_yjmk" name="txtLrc" xy="379,787" size="380,46" fontSize="34" color="#b8857b" align="center" autoSize="shrink" text="可获得60充值经验"/>
+    <component id="n19_droi" name="btnUp" src="droi3c" fileName="components/BtnUp.xml" xy="63,380"/>
+    <component id="n20_droi" name="btnNext" src="droi3d" fileName="components/BtnNext.xml" xy="877,386"/>
+    <component id="n21_droi" name="btnBack" src="qqhz26" fileName="components/BnBack.xml" xy="498,940"/>
   </displayList>
 </component>

+ 4 - 4
FGUIProject/assets/EnduringGiftBox/SpecialOfferGiftBoxUI.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="1080,1231">
+<component size="1080,1116">
   <displayList>
     <image id="n0_yjmk" name="n0" src="yjmk2v" fileName="images/bg02.png" xy="-9,142"/>
     <image id="n1_yjmk" name="n1" src="yjmk2u" fileName="images/bg01.png" xy="29,15"/>
@@ -12,8 +12,8 @@
       <item/>
       <item/>
     </list>
-    <image id="n19_yjmk" name="back" src="yjmk2s" fileName="images/back2.png" xy="494,1098"/>
-    <image id="n20_yjmk" name="btnNext" src="yjmk2k" fileName="images/xsqg_fy_an.png" xy="933,488"/>
-    <image id="n21_yjmk" name="btnUp" src="yjmk2o" fileName="images/xsqg_fy_an_2.png" xy="-22,483"/>
+    <component id="n22_droi" name="btnUp" src="droi3c" fileName="components/BtnUp.xml" xy="-22,488"/>
+    <component id="n23_droi" name="btnNext" src="droi3d" fileName="components/BtnNext.xml" xy="933,488"/>
+    <component id="n24_droi" name="back" src="qqhz26" fileName="components/BnBack.xml" xy="494,1098"/>
   </displayList>
 </component>

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -177,6 +177,9 @@ namespace GFGGame
             ArenaDataManager.Instance.Clear();
             ChatDataManager.Instance.Clear();
             ActivityDataManager.Instance.Clear();
+            ActivityGlobalDataManager.Instance.Clear();
+            EnduringGiftBoxDataManager.Instance.Clear();
+            LimitedTimeGiftBoxDataManager.Instance.Clear();
             GameGlobal.zoneScene.GetComponent<SessionComponent>()?.Disconnect();
             GameGlobal.zoneScene.GetComponent<ServerInfosComponent>()?.ServerInfoList?.Clear();
             GameGlobal.zoneScene.GetComponent<AccountInfoComponent>()?.Clear();

+ 6 - 0
GameClient/Assets/Game/HotUpdate/Data/ActivityGlobalDataManager.cs

@@ -23,6 +23,12 @@ namespace GFGGame
 
         private Dictionary<int, List<int>> activityInfosByType = new Dictionary<int, List<int>>();
 
+        public void Clear()
+        {
+            activityInfos.Clear();
+            activityInfosByType.Clear();
+        }
+        
         //添加活动数据
         public void AddActivityInfo(ActivityInfo activityInfo)
         {

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/EnduringGiftBoxDataManager.cs

@@ -16,7 +16,7 @@ namespace GFGGame
         private static Dictionary<int, int> _dayAllRebateItemDic = new Dictionary<int, int>();
         public Dictionary<int, int> DayAllRebateItemDic => _dayAllRebateItemDic;
 
-        public void InitData()
+        public void Clear()
         {
             _dayRebateItemIds.Clear();
             _dayAllRebateItemDic.Clear();

+ 6 - 6
GameClient/Assets/Game/HotUpdate/Data/LimitedTimeGiftBoxDataManager.cs

@@ -22,14 +22,14 @@ namespace GFGGame
         //圆形样式数据5--时间条件的数据
         private List<LimitedTimeGiftBoxItemYxData> _ltgGbItemData5 = new List<LimitedTimeGiftBoxItemYxData>();
         public List<LimitedTimeGiftBoxItemYxData> LtgGbItemData5 => _ltgGbItemData5;
-        
-        public void UpAllData()
+
+        public void Clear()
         {
-            UpLtgGbItemData3();
-            UpLtgGbItemData4();
-            UpLtgGbItemData5();
+            _ltgGbItemData3.Clear();
+            _ltgGbItemData4.Clear();
+            _ltgGbItemData5.Clear();
         }
-
+        
         public void UpLtgGbItemData3()
         {
             _ltgGbItemData3.Clear();

+ 8 - 8
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/EnduringGiftBox/UI_SpecialOfferGiftBoxUI.cs

@@ -9,9 +9,9 @@ namespace UI.EnduringGiftBox
         public GComponent target;
         public GTextField m_txtBoxResidueTime;
         public GList m_list;
-        public GImage m_back;
-        public GImage m_btnNext;
-        public GImage m_btnUp;
+        public GComponent m_btnUp;
+        public GComponent m_btnNext;
+        public GComponent m_back;
         public const string URL = "ui://bdi1qe15yjmk28";
         public const string PACKAGE_NAME = "EnduringGiftBox";
         public const string RES_NAME = "SpecialOfferGiftBoxUI";
@@ -61,17 +61,17 @@ namespace UI.EnduringGiftBox
         {
             m_txtBoxResidueTime = (GTextField)comp.GetChild("txtBoxResidueTime");
             m_list = (GList)comp.GetChild("list");
-            m_back = (GImage)comp.GetChild("back");
-            m_btnNext = (GImage)comp.GetChild("btnNext");
-            m_btnUp = (GImage)comp.GetChild("btnUp");
+            m_btnUp = (GComponent)comp.GetChild("btnUp");
+            m_btnNext = (GComponent)comp.GetChild("btnNext");
+            m_back = (GComponent)comp.GetChild("back");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_txtBoxResidueTime = null;
             m_list = null;
-            m_back = null;
-            m_btnNext = null;
             m_btnUp = null;
+            m_btnNext = null;
+            m_back = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ServerProxy/EnduringGiftBoxSProxy.cs

@@ -15,7 +15,7 @@ namespace GFGGame
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 {
-                    EnduringGiftBoxDataManager.Instance.InitData();
+                    EnduringGiftBoxDataManager.Instance.Clear();
                     foreach (var item in response.DayAllItemResidues)
                     {
                         EnduringGiftBoxDataManager.Instance.UpDayAllRebateItemDic(item.ItemId, item.ResidueNum);

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

@@ -27,7 +27,7 @@ namespace GFGGame
             packageName = UI_RushSaleGiftBoxUI.PACKAGE_NAME;
             _ui = UI_RushSaleGiftBoxUI.Create();
             this.viewCom = _ui.target;
-            // this.viewCom.Center();
+            this.viewCom.Center();
             this.modal = true;
             viewAnimationType = EnumViewAnimationType.None;
 
@@ -286,7 +286,7 @@ namespace GFGGame
         protected override void OnHide()
         {
             this.RemoveEventListener();
-            Dispose();
+            //Dispose();
             base.Hide();
         }
 

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

@@ -57,12 +57,14 @@ namespace GFGGame
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
+            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpViewNone);
         }
 
         protected override void RemoveEventListener()
         {
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
             EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
+            EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpViewNone);
             base.RemoveEventListener();
         }
 
@@ -107,6 +109,27 @@ namespace GFGGame
 
             var data = ListUtil.Navigate(list, type, _pageIndex, out int newIndex);
             _pageIndex = newIndex;
+            
+            _ui.m_btnUp.visible = true;
+            _ui.m_btnNext.visible = true;
+            if (list.Count == 1)
+            {
+                _ui.m_btnUp.visible = false;
+                _ui.m_btnNext.visible = false;
+            }
+            else
+            {
+                //翻页翻到了最后一条数据
+                if (list.Count == _pageIndex + 1)
+                {
+                    _ui.m_btnNext.visible = false;
+                }
+
+                if (_pageIndex == 0)
+                {
+                    _ui.m_btnUp.visible = false;
+                }
+            }
 
             _ui.m_txtBoxResidueTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), data.EndTime);
             _ui.m_list.data = data.ShopCfgIds;
@@ -194,7 +217,7 @@ namespace GFGGame
         private void ChildListItemRender(int index, GObject obj)
         {
             UI_ComRewardIconItem uiItemChild = UI_ComRewardIconItem.Proxy(obj);
-            var shopCfg = uiItemChild.target.parent.data as ShopCfg;
+            var shopCfg = uiItemChild.target.parent.parent.data as ShopCfg;
             var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
 
             int[][] result;
@@ -236,8 +259,7 @@ namespace GFGGame
 
         private void UpViewNone()
         {
-            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData4();
-            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData5();
+            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData3();
             UpdateView(ListUtil.NavigateType.None);
         }
 

+ 59 - 4
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -189,7 +189,7 @@ namespace GFGGame
             MainDataManager.Instance.CanSwipe = false;
             GRoot.inst.touchable = false;
             _ui.m_loaGuidestudio.visible = true;
-
+            
             _ui.m_headBar.m_txtName.text = RoleDataManager.roleName;
             if (_sceneObject == null)
             {
@@ -215,6 +215,7 @@ namespace GFGGame
                 GameGlobal.lastLoginTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
             }
             SetPos();
+
             Timers.inst.AddUpdate(CheckGuide);
             Timers.inst.AddUpdate(Update);
         }
@@ -637,7 +638,19 @@ namespace GFGGame
         //列表
         private void OnClickBtnGiftBag1()
         {
-          //ActivityType.XSLB1
+            var activityInfoByTypeList =
+              ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB1);
+
+          var list = activityInfoByTypeList
+              .Where(a => a.endTime > TimeInfo.Instance.ServerNow()).ToList();
+          if (list.Count == 0)
+          {
+              PromptController.Instance.ShowFloatTextPrompt("活动已结束");
+          }
+          else
+          {
+              ViewManager.Show<SpecialOfferGiftBoxView>();
+          }
         }
         
         //圆形
@@ -657,6 +670,40 @@ namespace GFGGame
                 ViewManager.Show<RushSaleGiftBoxView>(new object[] { ActivityType.XSLB2, this.viewData });
             }
         }
+        
+        private void UpGiftBox1()
+        {
+            var activityInfoByTypeList =
+                ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB1);
+
+            var list = activityInfoByTypeList
+                .Where(a => a.endTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                _ui.m_txtGiftBagTime1.text = "已结束";
+            }
+            else
+            {
+                _ui.m_txtGiftBagTime1.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].endTime);
+            }
+        }
+        
+        private void UpGiftBox2()
+        {
+            var activityInfoByTypeList =
+                ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB2);
+
+            var list = activityInfoByTypeList
+                .Where(a => a.endTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                _ui.m_txtGiftBagTime2.text = "已结束";
+            }
+            else
+            {
+                _ui.m_txtGiftBagTime2.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].endTime);
+            }
+        }
 
         private void Update(object param)
         {
@@ -692,12 +739,20 @@ namespace GFGGame
             }
 
             //特惠礼包/限时礼包窗口内的倒计时
-            if (ViewManager.isViewOpen(typeof(SpecialOfferGiftBoxView).FullName))
+            UpGiftBox1();
+            UpGiftBox2();
+            if (ViewManager.isViewOpen(nameof(SpecialOfferGiftBoxView)))
             {
                 var specialOfferGiftBoxView =
-                    ViewManager.GetUIView(typeof(SpecialOfferGiftBoxView).FullName) as SpecialOfferGiftBoxView;
+                    ViewManager.GetUIView(nameof(SpecialOfferGiftBoxView)) as SpecialOfferGiftBoxView;
                 specialOfferGiftBoxView?.UpTime();
             }
+            if (ViewManager.isViewOpen(nameof(RushSaleGiftBoxView)))
+            {
+                var rushSaleGiftBoxView =
+                    ViewManager.GetUIView(nameof(RushSaleGiftBoxView)) as RushSaleGiftBoxView;
+                rushSaleGiftBoxView?.UpTime();
+            }
         }
 
         private void ShowExitAlert()

BIN
GameClient/Assets/ResIn/UI/EnduringGiftBox/EnduringGiftBox_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/EnduringGiftBox/EnduringGiftBox_atlas0.png


BIN
GameClient/Assets/ResIn/UI/EnduringGiftBox/EnduringGiftBox_fui.bytes