From bfa3020718eb4b143c4e720fc55d7debc7b09c16 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 04 二月 2021 09:42:12 +0800
Subject: [PATCH] 8710 【开发】【主干】【BT2】根据世界等级配置奖励(成长必买改为通知对应不同世界等级的物品信息)

---
 System/Welfare/CZBMWin.cs                                                                |   14 ++--
 System/Welfare/CZBMModel.cs                                                              |   21 ++++++
 System/Welfare/OperationCZBM.cs                                                          |   19 -----
 Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA31_tagMCActGrowupBuyInfo.cs           |   94 +++++++++++++++++++-----------
 System/Welfare/CZBMCell.cs                                                               |   14 ++--
 Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA31_tagMCActGrowupBuyInfo.cs |   11 ---
 6 files changed, 97 insertions(+), 76 deletions(-)

diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA31_tagMCActGrowupBuyInfo.cs b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA31_tagMCActGrowupBuyInfo.cs
index 3188098..62b752b 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA31_tagMCActGrowupBuyInfo.cs
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA31_tagMCActGrowupBuyInfo.cs
@@ -1,20 +1,13 @@
 using UnityEngine;
 using System.Collections;
 using Snxxz.UI;
-
-// AA 31 锟缴筹拷锟斤拷锟斤拷疃拷锟较� #tagMCActGrowupBuyInfo
-
-
+// AA 31 鎴愰暱蹇呬拱娲诲姩淇℃伅 #tagMCActGrowupBuyInfo
 
 public class DTCAA31_tagMCActGrowupBuyInfo : DtcBasic {
-
     public override void Done(GameNetPackBasic vNetPack) {
-
         base.Done(vNetPack);
-
         HAA31_tagMCActGrowupBuyInfo vNetData = vNetPack as HAA31_tagMCActGrowupBuyInfo;
+
         OperationTimeHepler.Instance.UpdateCZBMRecharge(vNetData);
     }
-
 }
-
diff --git a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA31_tagMCActGrowupBuyInfo.cs b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA31_tagMCActGrowupBuyInfo.cs
index e97f1b4..c4152e6 100644
--- a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA31_tagMCActGrowupBuyInfo.cs
+++ b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA31_tagMCActGrowupBuyInfo.cs
@@ -1,35 +1,59 @@
-using UnityEngine;
-using System.Collections;
-
-// AA 31 成长必买活动信息 #tagMCActGrowupBuyInfo

-

-public class HAA31_tagMCActGrowupBuyInfo : GameNetPackBasic {

-    public string StartDate;    // 开始日期 y-m-d

-    public string EndtDate;    // 结束日期 y-m-d

-    public byte GroupCount;    // 循环购买礼包组数

-    public  tagMCActGrowupBuyGroup[] GroupList;    //循环购买礼包组列表

-

-    public HAA31_tagMCActGrowupBuyInfo () {

-        _cmd = (ushort)0xAA31;

-    }

-

-    public override void ReadFromBytes (byte[] vBytes) {

-        TransBytes (out StartDate, vBytes, NetDataType.Chars, 10);

-        TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10);

-        TransBytes (out GroupCount, vBytes, NetDataType.BYTE);

-        GroupList = new tagMCActGrowupBuyGroup[GroupCount];

-        for (int i = 0; i < GroupCount; i ++) {

-            GroupList[i] = new tagMCActGrowupBuyGroup();

-            TransBytes (out GroupList[i].BuyCount, vBytes, NetDataType.BYTE);

-            TransBytes (out GroupList[i].BuyCTGIDList, vBytes, NetDataType.DWORD, GroupList[i].BuyCount);

-            TransBytes (out GroupList[i].PlayerBuyIndex, vBytes, NetDataType.BYTE);

-        }

-    }

-

-    public struct tagMCActGrowupBuyGroup {

-        public byte BuyCount;        // 循环购买礼包数

-        public  uint[] BuyCTGIDList;        // 循环购买礼包充值ID列表

-        public byte PlayerBuyIndex;        // 玩家当前可购买的礼包充值ID在列表中索引

-    }

-

-}

+using UnityEngine;
+using System.Collections;
+
+// AA 31 鎴愰暱蹇呬拱娲诲姩淇℃伅 #tagMCActGrowupBuyInfo
+
+public class HAA31_tagMCActGrowupBuyInfo : GameNetPackBasic {
+    public string StartDate;    // 寮�濮嬫棩鏈� y-m-d
+    public string EndtDate;    // 缁撴潫鏃ユ湡 y-m-d
+    public byte GroupCount;    // 寰幆璐拱绀煎寘缁勬暟
+    public  tagMCActGrowupBuyGroup[] GroupList;    //寰幆璐拱绀煎寘缁勫垪琛�
+
+    public HAA31_tagMCActGrowupBuyInfo () {
+        _cmd = (ushort)0xAA31;
+    }
+
+    public override void ReadFromBytes (byte[] vBytes) {
+        TransBytes (out StartDate, vBytes, NetDataType.Chars, 10);
+        TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10);
+        TransBytes (out GroupCount, vBytes, NetDataType.BYTE);
+        GroupList = new tagMCActGrowupBuyGroup[GroupCount];
+        for (int i = 0; i < GroupCount; i ++) {
+            GroupList[i] = new tagMCActGrowupBuyGroup();
+            TransBytes (out GroupList[i].BuyCount, vBytes, NetDataType.BYTE);
+            GroupList[i].BuyCTGIDList = new tagMCActGrowupBuyCTGInfo[GroupList[i].BuyCount];
+            for (int j = 0; j < GroupList[i].BuyCount; j ++) {
+                GroupList[i].BuyCTGIDList[j] = new tagMCActGrowupBuyCTGInfo();
+                TransBytes (out GroupList[i].BuyCTGIDList[j].CTGID, vBytes, NetDataType.BYTE);
+                TransBytes (out GroupList[i].BuyCTGIDList[j].GainItemCount, vBytes, NetDataType.BYTE);
+                GroupList[i].BuyCTGIDList[j].GainItemList = new tagMCActGrowupBuyCTGItem[GroupList[i].BuyCTGIDList[j].GainItemCount];
+                for (int k = 0; k < GroupList[i].BuyCTGIDList[j].GainItemCount; k ++) {
+                    GroupList[i].BuyCTGIDList[j].GainItemList[k] = new tagMCActGrowupBuyCTGItem();
+                    TransBytes (out GroupList[i].BuyCTGIDList[j].GainItemList[k].ItemID, vBytes, NetDataType.DWORD);
+                    TransBytes (out GroupList[i].BuyCTGIDList[j].GainItemList[k].ItemCount, vBytes, NetDataType.WORD);
+                    TransBytes (out GroupList[i].BuyCTGIDList[j].GainItemList[k].IsBind, vBytes, NetDataType.BYTE);
+                }
+            }
+            TransBytes (out GroupList[i].PlayerBuyIndex, vBytes, NetDataType.BYTE);
+        }
+    }
+
+    public struct tagMCActGrowupBuyCTGItem {
+        public uint ItemID;
+        public ushort ItemCount;
+        public byte IsBind;
+    }
+
+    public struct tagMCActGrowupBuyGroup {
+        public byte BuyCount;        // 寰幆璐拱绀煎寘鏁�
+        public  tagMCActGrowupBuyCTGInfo[] BuyCTGIDList;        // 寰幆璐拱绀煎寘鍏呭�糏D淇℃伅鍒楄〃
+        public byte PlayerBuyIndex;        // 鐜╁褰撳墠鍙喘涔扮殑绀煎寘鍏呭�糏D鍦ㄥ垪琛ㄤ腑绱㈠紩
+    }
+
+    public struct tagMCActGrowupBuyCTGInfo {
+        public byte CTGID;        // 鍏呭�艰〃ID
+        public byte GainItemCount;        // 鑾峰緱鐗╁搧鏁�
+        public  tagMCActGrowupBuyCTGItem[] GainItemList;        // 鑾峰緱鐗╁搧鍒楄〃锛屾浛鎹㈠厖鍊艰〃涓殑 GainItemList 瀛楁淇℃伅
+    }
+
+}
diff --git a/System/Welfare/CZBMCell.cs b/System/Welfare/CZBMCell.cs
index 5300c65..4c77149 100644
--- a/System/Welfare/CZBMCell.cs
+++ b/System/Welfare/CZBMCell.cs
@@ -25,7 +25,7 @@
             {
                 OperationCZBM operation = operationBase as OperationCZBM;
                 
-                int ctgID = (int)operation.CZBMGiftInfo[model.selectIndex].ctgList[index];
+                int ctgID = (int)operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList[index].CTGID;
                 var ctgInfo = CTGConfig.Get(ctgID);
                 OrderInfoConfig orderInfoConfig;
                 if (vipModel.TryGetOrderInfo(ctgID, out orderInfoConfig))
@@ -34,7 +34,7 @@
                     m_GetBtn.SetListener(()=>{
                         if (index != operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex)
                         {
-                            int ctgID2 = (int)operation.CZBMGiftInfo[model.selectIndex].ctgList[operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex];
+                            int ctgID2 = (int)operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList[operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex].CTGID;
                             var ctgInfo2 = CTGConfig.Get(ctgID2);
                             SysNotifyMgr.Instance.ShowTip("CZBMLimit", ctgInfo2.Title);
                             return;
@@ -44,20 +44,20 @@
                 }
 
                 //鏄剧ず鐗╁搧
-                var _list = vipModel.m_RechargeGainItemDict[ctgID];
+                var _list = model.GetGiftsByCTGID(ctgID);
                 for (int i = 0; i < m_Items.Length; i++)
                 {
-                    if (i >= _list.Count)
+                    if (i >= _list.Length)
                     {
                         m_Items[i].gameObject.SetActive(false);
                         continue;
                     }
                     m_Items[i].gameObject.SetActive(true);
                     
-                    var itemID = _list[i].id;
+                    var itemID = (int)_list[i].ItemID;
                     var ItemCell = m_Items[i];
                     var Item = ItemConfig.Get(itemID);
-                    ItemCellModel cellModel = new ItemCellModel(itemID, true, (ulong)_list[i].count);
+                    ItemCellModel cellModel = new ItemCellModel(itemID, true, (ulong)_list[i].ItemCount);
                     ItemCell.Init(cellModel);
                     ItemCell.button.RemoveAllListeners();
                     ItemCell.button.AddListener(() =>
@@ -75,7 +75,7 @@
                 }
                 else
                 {
-                    int ctgID1 = (int)operation.CZBMGiftInfo[model.selectIndex].ctgList[index - 1];
+                    int ctgID1 = (int)operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList[index - 1].CTGID;
                     var ctgInfo1 = CTGConfig.Get(ctgID1);
                     m_GiftLimitTxt.text = Language.Get("CZBMLimit", ctgInfo1.Title);
                 }
diff --git a/System/Welfare/CZBMModel.cs b/System/Welfare/CZBMModel.cs
index 5cd5018..6fe20bc 100644
--- a/System/Welfare/CZBMModel.cs
+++ b/System/Welfare/CZBMModel.cs
@@ -37,8 +37,27 @@
     {
 
     }
-    
 
+    public HAA31_tagMCActGrowupBuyInfo.tagMCActGrowupBuyCTGItem[] GetGiftsByCTGID(int ctgID)
+    {
+        OperationCZBM operation;
+        if (OperationTimeHepler.Instance.TryGetOperation(Operation.CZBMGift, out operation))
+        {
+
+            for (int i = 0; i < operation.CZBMGiftInfo.Count; i++)
+            {
+                for (int j = 0; j < operation.CZBMGiftInfo[i].BuyCTGIDList.Length; j++)
+                {
+                    if (operation.CZBMGiftInfo[i].BuyCTGIDList[j].CTGID == ctgID)
+                    {
+                        return operation.CZBMGiftInfo[i].BuyCTGIDList[j].GainItemList;
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
 }
 
 
diff --git a/System/Welfare/CZBMWin.cs b/System/Welfare/CZBMWin.cs
index 13af84c..81c78ac 100644
--- a/System/Welfare/CZBMWin.cs
+++ b/System/Welfare/CZBMWin.cs
@@ -75,10 +75,10 @@
                 OperationCZBM operation = operationBase as OperationCZBM;
                 foreach(var buyInfo in operation.CZBMGiftInfo)
                 {
-                    if (buyInfo.PlayerBuyIndex == buyInfo.ctgList.Count - 1)
+                    if (buyInfo.PlayerBuyIndex == buyInfo.BuyCTGIDList.Length - 1)
                     {
                         //鏈�鍚庝竴妗f槸鍚﹀凡璐拱
-                        int ctgID = (int)buyInfo.ctgList[buyInfo.PlayerBuyIndex];
+                        int ctgID = (int)buyInfo.BuyCTGIDList[buyInfo.PlayerBuyIndex].CTGID;
 
                         VipModel.RechargeCount _rechargeCount;
                         if (vipModel.TryGetRechargeCount(ctgID, out _rechargeCount))
@@ -137,7 +137,7 @@
                     return;
                 }
                 m_BuyInfoCtrl.Refresh();
-                for(var i = 0; i < operation.CZBMGiftInfo[model.selectIndex].ctgList.Count; i++)
+                for(var i = 0; i < operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList.Length; i++)
                 {
                     m_BuyInfoCtrl.AddCell(ScrollerDataType.Header, i);
                 }
@@ -152,15 +152,15 @@
 
         private void ShowTip(OperationCZBM operation)
         {
-            if (operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex >= operation.CZBMGiftInfo[model.selectIndex].ctgList.Count)
+            if (operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex >= operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList.Length)
             {
                 m_ShowTip.text = string.Empty;
                 return;
             }
-            int ctgID = (int)operation.CZBMGiftInfo[model.selectIndex].ctgList[operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex];
+            int ctgID = (int)operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList[operation.CZBMGiftInfo[model.selectIndex].PlayerBuyIndex].CTGID;
             var ctgInfo = CTGConfig.Get(ctgID);
 
-            int ctgID1 = (int)operation.CZBMGiftInfo[model.selectIndex].ctgList[0];
+            int ctgID1 = (int)operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList[0].CTGID;
             var ctgInfo1 = CTGConfig.Get(ctgID1);
 
             m_ShowTip.text = Language.Get("CZBMBuyTip", ctgInfo.Title, ctgInfo1.Title, ctgInfo.Title);
@@ -211,7 +211,7 @@
             m_GroupCtrl.m_Scorller.RefreshActiveCellViews();
 
             m_BuyInfoCtrl.Refresh();
-            for(var i = 0; i < operation.CZBMGiftInfo[model.selectIndex].ctgList.Count; i++)
+            for(var i = 0; i < operation.CZBMGiftInfo[model.selectIndex].BuyCTGIDList.Length; i++)
             {
                 m_BuyInfoCtrl.AddCell(ScrollerDataType.Header, i);
             }
diff --git a/System/Welfare/OperationCZBM.cs b/System/Welfare/OperationCZBM.cs
index 9d07341..f471fa9 100644
--- a/System/Welfare/OperationCZBM.cs
+++ b/System/Welfare/OperationCZBM.cs
@@ -7,7 +7,7 @@
 
     public class OperationCZBM : OperationBase
     {
-        public List<CZBMBuyInfo> CZBMGiftInfo = new List<CZBMBuyInfo>();
+        public List<HAA31_tagMCActGrowupBuyInfo.tagMCActGrowupBuyGroup> CZBMGiftInfo = new List<HAA31_tagMCActGrowupBuyInfo.tagMCActGrowupBuyGroup>();
         public override bool SatisfyOpenCondition()
         {
             return true;
@@ -18,25 +18,10 @@
             CZBMGiftInfo.Clear();
             for(int i = 0; i < package.GroupCount; i++)
             {
-                
-                CZBMBuyInfo buyInfo = new CZBMBuyInfo();
-                buyInfo.PlayerBuyIndex = package.GroupList[i].PlayerBuyIndex;
-                foreach(var ctgID in package.GroupList[i].BuyCTGIDList)
-                {
-                    buyInfo.ctgList.Add(ctgID);
-                }
-                
-                CZBMGiftInfo.Add(buyInfo);
-
+                CZBMGiftInfo.Add(package.GroupList[i]);
             }
         }
 
-
-        public class CZBMBuyInfo
-        {
-            public byte PlayerBuyIndex;
-            public List<uint> ctgList = new List<uint>();
-        }
     }
 }
 

--
Gitblit v1.8.0