Ver Fonte

常驻礼包

何晓捷 há 2 anos atrás
pai
commit
492fc68e35

+ 5 - 6
FGUIProject/assets/EnduringGiftBox/EnduringGiftBoxUI.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="1080,1118">
+<component size="1080,1076">
   <displayList>
     <image id="n0_qqhz" name="n0" src="qqhze" fileName="images/diban.png" xy="23,260" group="n7_qqhz"/>
     <graph id="n30_qqhz" name="holderPaoMax" xy="4,59" size="401,298" group="n7_qqhz"/>
@@ -14,7 +14,7 @@
     <group id="n7_qqhz" name="n7" xy="-1,-28" size="1080,1105"/>
     <image id="n27_qqhz" name="n27" src="qqhzq" fileName="images/zsx_flower1.png" xy="224,300" group="n17_qqhz"/>
     <text id="n9_qqhz" name="txtNeed" xy="481,163" size="444,47" group="n17_qqhz" fontSize="32" color="#915e15" align="center" autoSize="none" text="是否花费20粉钻购买60体力?"/>
-    <text id="n34_qqhz" name="txtNum" xy="481,208" pivot="0.5,0" size="444,115" group="n17_qqhz" fontSize="32" color="#915e15" align="center" autoSize="none" text="体力每5分钟恢复1点&#xA;(今日剩余购买次数:8/8)"/>
+    <text id="n34_qqhz" name="txtNum" xy="481,208" size="444,115" group="n17_qqhz" fontSize="32" color="#915e15" align="center" autoSize="none" text="体力每5分钟恢复1点&#xA;(今日剩余购买次数:8/8)"/>
     <component id="n12_qqhz" name="btnCancel" src="qqhzs" fileName="components/BtnCancel.xml" xy="362,326" group="n17_qqhz"/>
     <component id="n14_qqhz" name="btnSure" src="qqhzu" fileName="components/BtnSub.xml" xy="648,326" group="n17_qqhz"/>
     <group id="n17_qqhz" name="n17" xy="224,163" size="799,238" group="n26_qqhz"/>
@@ -24,7 +24,7 @@
       <item/>
     </list>
     <group id="n26_qqhz" name="n26" xy="71,163" size="952,777"/>
-    <image id="n28_qqhz" name="btnBack" src="qqhz2" fileName="images/back.png" xy="497,1064"/>
+    <component id="n36_qqhz" name="btnBack" src="qqhz26" fileName="components/BnBack.xml" xy="497,1064"/>
   </displayList>
   <transition name="t1">
     <item time="0" type="Alpha" target="n0_qqhz" tween="true" startValue="0" endValue="1" duration="15"/>
@@ -33,10 +33,10 @@
     <item time="0" type="Alpha" target="n15_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n1_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n27_qqhz" value="0"/>
-    <item time="0" type="Alpha" target="n28_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n29_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n2_qqhz" tween="true" startValue="0" endValue="1" duration="15"/>
     <item time="0" type="Alpha" target="n33_qqhz" value="0"/>
+    <item time="0" type="Alpha" target="n34_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n3_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n5_qqhz" value="0"/>
     <item time="0" type="Alpha" target="n6_qqhz" value="0"/>
@@ -52,14 +52,13 @@
     <item time="12" type="XY" target="n29_qqhz" tween="true" startValue="36,-5" endValue="23,-28" duration="12"/>
     <item time="13" type="Alpha" target="n5_qqhz" tween="true" startValue="0.5" endValue="1" duration="8"/>
     <item time="14" type="Alpha" target="n33_qqhz" tween="true" startValue="1" endValue="0.2" duration="11"/>
+    <item time="14" type="Alpha" target="n34_qqhz" tween="true" startValue="0.7" endValue="1" duration="8"/>
     <item time="14" type="Alpha" target="n9_qqhz" tween="true" startValue="0.7" endValue="1" duration="8"/>
     <item time="15" type="Alpha" target="n12_qqhz" tween="true" startValue="0.7" endValue="1" duration="8"/>
     <item time="15" type="Alpha" target="n14_qqhz" tween="true" startValue="0.7" endValue="1" duration="8"/>
-    <item time="15" type="Alpha" target="n28_qqhz" value="0.75"/>
     <item time="18" type="Alpha" target="n15_qqhz" tween="true" startValue="0.7" endValue="1" duration="8"/>
     <item time="18" type="Alpha" target="n27_qqhz" tween="true" startValue="0.7" endValue="1" duration="8"/>
     <item time="19" type="Alpha" target="n3_qqhz" tween="true" startValue="0.7" endValue="1" duration="6"/>
-    <item time="21" type="Alpha" target="n28_qqhz" value="1"/>
     <item time="25" type="Alpha" target="n30_qqhz" tween="true" startValue="0.5" endValue="1" duration="18"/>
     <item time="25" type="Visible" target="n33_qqhz" value="false"/>
     <item time="43" type="Alpha" target="n30_qqhz" tween="true" startValue="1" endValue="0" duration="24"/>

+ 6 - 0
FGUIProject/assets/EnduringGiftBox/components/BnBack.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component size="88,102">
+  <displayList>
+    <image id="n0_qqhz" name="n0" src="qqhz2" fileName="images/back.png" xy="0,0"/>
+  </displayList>
+</component>

+ 1 - 0
FGUIProject/assets/EnduringGiftBox/package.xml

@@ -47,6 +47,7 @@
     <component id="qqhz1r" name="ComGouMaiGetText.xml" path="/components/" exported="true"/>
     <component id="qqhz1v" name="EnduringGiftBoxUIbackups.xml" path="/"/>
     <image id="qqhz25" name="tili.png" path="/images/"/>
+    <component id="qqhz26" name="BnBack.xml" path="/components/" exported="true"/>
   </resources>
   <publish name="" path="../GameClient/Assets/ResIn/UI/EnduringGiftBox" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

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

@@ -120,5 +120,7 @@ namespace GFGGame
         public const string OTHER_ROLE_INFO_CHANGE = "OTHER_ROLE_INFO_CHANGE"; //���������Ϣ�仯
         public const string NOTICE_CHAT_MESSAGE = "NOTICE_CHAT_MESSAGE"; //֪ͨ������Ϣ
         public const string ACTIVE_SKILL = "ACTIVE_SKILL"; //���ܼ���
+        
+        public const string CONTINUOUS_REBATE_GIFT = "CONTINUOUS_REBATE_GIFT";//领取连续返利礼包
     }
 }

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

@@ -112,6 +112,7 @@ namespace GFGGame
             await ShopSProxy.ReqShopInfo();
             await StudioSProxy.ReqStudioInfos();
             await RoleInfoSProxy.ReqPersonalInfo();
+            await EnduringGiftBoxSProxy.ReqGetAllGiftBagRebateStatus();
 
             GameGlobal.lastLoginTime = StorageDataManager.Instance.GetStorageValue(ConstStorageId.LAST_LOGIN_TIME);
             long lastTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);

+ 34 - 10
GameClient/Assets/Game/HotUpdate/Data/EnduringGiftBoxDataManager.cs

@@ -6,24 +6,48 @@ using ET;
 
 namespace GFGGame
 {
-    public class EnduringGiftBoxDataManager
+    public class EnduringGiftBoxDataManager : SingletonBase<EnduringGiftBoxDataManager>
     {
-        //礼包id,状态:根据常量 EnduringGiftBoxBuyStatus --每天的领取状态
-        public static Dictionary<int, int> GiftBoxStateDic = new Dictionary<int, int>();
-        
-        public static void InitData()
+        //当天可以领取的列表物品Id
+        private static HashSet<int> _dayAllRebateItemIds = new HashSet<int>();
+
+        //当天已经领取的返利物品Id
+        private static HashSet<int> _dayRebateItemIds = new HashSet<int>();
+
+        public HashSet<int> DayAllRebateItemIds => _dayAllRebateItemIds;
+        public HashSet<int> DayRebateItemIds => _dayRebateItemIds;
+
+        public void InitData()
+        {
+            _dayRebateItemIds.Clear();
+            _dayAllRebateItemIds.Clear();
+        }
+
+        public void AddDayRebateItemIds(int itemId)
         {
-            GiftBoxStateDic.Clear();
+            _dayRebateItemIds.Add(itemId);
         }
 
-        public static void UpdateGiftBoxState(int giftCfgId, int state)
+        public void AddDayAllRebateItemIds(int itemId)
         {
-            GiftBoxStateDic[giftCfgId] = state;
+            _dayAllRebateItemIds.Add(itemId);
         }
 
-        public static void UpdateGiftBoxResidueNum(int giftCfgId, int num)
+        //当天是否需要领取该返利物品
+        public bool DayIsRebateGiftBox(int itemId)
         {
-            GiftBoxStateDic[giftCfgId] = num;
+            if (!_dayAllRebateItemIds.Contains(itemId))
+            {
+                return false;
+            }
+
+            if (_dayRebateItemIds.Contains(itemId))
+            {
+                return false;
+            }
+
+            //需要领取
+            return true;
         }
     }
 }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/EnduringGiftBox/UI_EnduringGiftBoxUI.cs

@@ -17,7 +17,7 @@ namespace UI.EnduringGiftBox
         public GButton m_btnSure;
         public GTextField m_txtPromptExt;
         public GList m_list;
-        public GImage m_btnBack;
+        public GComponent m_btnBack;
         public Transition m_t1;
         public Transition m_t2;
         public const string URL = "ui://bdi1qe15qqhz1";
@@ -77,7 +77,7 @@ namespace UI.EnduringGiftBox
             m_btnSure = (GButton)comp.GetChild("btnSure");
             m_txtPromptExt = (GTextField)comp.GetChild("txtPromptExt");
             m_list = (GList)comp.GetChild("list");
-            m_btnBack = (GImage)comp.GetChild("btnBack");
+            m_btnBack = (GComponent)comp.GetChild("btnBack");
             m_t1 = comp.GetTransition("t1");
             m_t2 = comp.GetTransition("t2");
         }

+ 56 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/EnduringGiftBoxSProxy.cs

@@ -0,0 +1,56 @@
+using System.Collections.Generic;
+using ET;
+
+namespace GFGGame
+{
+    public static class EnduringGiftBoxSProxy
+    {
+        //获取已经领取的返利物品ids
+        public static async ETTask<bool> ReqGetAllGiftBagRebateStatus()
+        {
+            S2C_GetAllGiftBagRebateStatus response = null;
+            response = (S2C_GetAllGiftBagRebateStatus)await MessageHelper.SendToServer(
+                new C2S_GetAllGiftBagRebateStatus() { });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    EnduringGiftBoxDataManager.Instance.InitData();
+                    foreach (var item in response.DayAllItemIds)
+                    {
+                        EnduringGiftBoxDataManager.Instance.AddDayAllRebateItemIds(item);
+                    }
+
+                    foreach (var item in response.ItemIds)
+                    {
+                        EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(item);
+                    }
+
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+        //请求领取连续返利礼包--的返利
+        public static async ETTask<bool> ReqGetGiftBagRebate(int shopId)
+        {
+            S2C_GiftBagRebate response = null;
+            response = (S2C_GiftBagRebate)await MessageHelper.SendToServer(
+                new C2S_GetGiftBagRebate() { ShopId = shopId });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    var itemDataList = ItemUtil.CreateItemDataList(response.ItemList);
+                    BonusController.TryShowBonusList(itemDataList);
+                    EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT);
+                    return true;
+                }
+            }
+
+            return false;
+        }
+    }
+}

+ 3 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/EnduringGiftBoxSProxy.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: bd0d41f7bbf64d279c5e9038fb140b41
+timeCreated: 1685433002

+ 47 - 22
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/EnduringGiftBoxView.cs

@@ -38,16 +38,11 @@ namespace GFGGame
             this.viewCom = _ui.target;
             this.viewCom.Center();
             this.modal = true;
-            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER; //先这样写,后面再改
-
-            //测试数据
-            EnduringGiftBoxDataManager.GiftBoxStateDic[110001] = 1;
-            EnduringGiftBoxDataManager.GiftBoxStateDic[110002] = 1;
-            EnduringGiftBoxDataManager.GiftBoxStateDic[110003] = 1;
-            EnduringGiftBoxDataManager.GiftBoxStateDic[110004] = 1;
-
+            viewAnimationType = EnumViewAnimationType.None;
+            
             _ui.m_btnSure.onClick.Add(OnClickBtnSure);
             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
+            _ui.m_btnBack.onClick.Add(OnClickBtnCancel);
         }
 
         public override void Dispose()
@@ -70,9 +65,23 @@ namespace GFGGame
         {
             base.OnShown();
             AddEffect();
+            _ui.m_t1.Play();
+            _ui.m_t2.Play();
             UpdateView();
         }
 
+        protected override void AddEventListener()
+        {
+            base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
+        }
+
+        protected override void RemoveEventListener()
+        {
+            base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
+        }
+
         private void AddEffect()
         {
             string resPath3;
@@ -183,7 +192,9 @@ namespace GFGGame
             item.m_comLeftGiftBox.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
             item.m_btnBuy.m_txtOldPrice.text = $"{shopCfg.originalPrice}";
             item.m_btnBuy.m_txtNewPrice.text = $"{shopCfg.price}元";
-            
+            item.m_comLeftGiftBox.target.data = itemCfg;
+            item.m_comLeftGiftBox.m_loaIcon.onClick.Add(OnListSelectorItemClick);
+
             if (shopCfg.refreshType == RefreshType.DAY) //也可以换成人民币来做条件
             {
                 //日刷
@@ -195,7 +206,7 @@ namespace GFGGame
                 item.m_txtWeekPrompt.visible = false;
                 item.m_icoWeekPromptTag.visible = false;
                 numItems = childItemCfg.itemsArr.Length;
-                
+
                 if (remainBuyNum == 0)
                 {
                     //已售完
@@ -216,7 +227,7 @@ namespace GFGGame
             else
             {
                 //周刷
-                var weekGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
+                var weekGiftBoxState = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(shopCfg.itemId);
                 item.m_comLeftGiftBox.m_comDiscount.target.visible = false;
                 item.m_comLeftGiftBox.m_comGouMaiGetText.target.visible = true;
                 var itemArr = itemCfg.itemsArr[0];
@@ -231,9 +242,9 @@ namespace GFGGame
                 item.m_icoWeekPromptTag.visible = true;
 
                 numItems = childItemCfg.param1Arr.Length;
-                
+
                 //是否需要领取
-                if (weekGiftBoxState == EnduringGiftBoxBuyStatus.NoGet)
+                if (weekGiftBoxState)
                 {
                     item.m_btnBuy.target.visible = false;
                     item.m_btnCurReceive.target.visible = true;
@@ -246,25 +257,38 @@ namespace GFGGame
                     //是否能购买
                     if (remainBuyNum == 0)
                     {
-                        //已售完
-                        item.m_btnBuy.target.visible = false;
-                        item.m_btnCurReceive.target.visible = true;
-                        item.m_btnCurReceive.m_receive.visible = false;
-                        item.m_btnCurReceive.m_received.visible = true;
-                        item.m_btnCurReceive.m_txtRec.text = "已领取";
+                        //已经领取
+                        if (EnduringGiftBoxDataManager.Instance.DayRebateItemIds.Contains(shopCfg.itemId))
+                        {
+                            item.m_btnBuy.target.visible = false;
+                            item.m_btnCurReceive.target.visible = true;
+                            item.m_btnCurReceive.m_receive.visible = false;
+                            item.m_btnCurReceive.m_received.visible = true;
+                            item.m_btnCurReceive.m_txtRec.text = "已领取";
+                        }
+                        else
+                        {
+                            item.m_btnCurReceive.target.visible = false;
+                            item.m_btnBuy.target.visible = true;
+                            item.m_btnBuy.m_bagGrey.visible = true;
+                            item.m_btnBuy.m_bagYellow.visible = false;
+                        }
                     }
                     else
                     {
                         //未售完
                         item.m_btnBuy.target.visible = true;
+                        item.m_btnBuy.m_bagGrey.visible = false;
+                        item.m_btnBuy.m_bagYellow.visible = true;
                         item.m_btnCurReceive.target.visible = false;
                     }
                 }
             }
+
             //领取按钮点击事件
             //购买按钮点击事件
             item.m_btnBuy.target.onClick.Add(OnBtnBuyClick);
-            
+
             item.m_list.data = shopCfg;
             item.m_list.itemRenderer = ChildListItemRender;
             item.m_list.numItems = numItems;
@@ -311,7 +335,7 @@ namespace GFGGame
             var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
             // uiItemChild.m_showRreceives.visible = false;
 
-            var curGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
+            //var curGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
             int[][] result;
             if (shopCfg.refreshType == RefreshType.DAY)
             {
@@ -330,7 +354,7 @@ namespace GFGGame
                 uiItemChild.m_bagYellowEx.visible = true;
                 uiItemChild.m_bagBlueEx.visible = false;
             }
-            
+
             // if (curGiftBoxState == EnduringGiftBoxBuyStatus.YesGet)
             // {
             //     uiItemChild.m_showRreceives.visible = true;
@@ -408,6 +432,7 @@ namespace GFGGame
 
         private void OnClickBtnCancel()
         {
+            Dispose();
             this.Hide();
         }
     }

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