Browse Source

Merge remote-tracking branch 'remotes/origin/zhaoyang' into guodong

# Conflicts:
#	GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes
guodong 3 years ago
parent
commit
0de40042e6

+ 7 - 4
GameClient/Assets/Editor/Excel/Scanner/ItemApproachScanner.cs

@@ -114,11 +114,14 @@ namespace GFGEditor
             }
             }
             foreach (LuckyBoxCfg cfg in dataArray)
             foreach (LuckyBoxCfg cfg in dataArray)
             {
             {
-                int dropId = cfg.bonus;
-                bool approach = CheckDropApproach(itemId, dropId);
-                if (approach)
+                for (int i = 0; i < cfg.bonusArr.Length; i++)
                 {
                 {
-                    return "ZHAI_XING";
+                    int dropId = cfg.bonusArr[i][0];
+                    bool approach = CheckDropApproach(itemId, dropId);
+                    if (approach)
+                    {
+                        return "ZHAI_XING";
+                    }
                 }
                 }
             }
             }
             return null;
             return null;

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

@@ -40,5 +40,7 @@ namespace GFGGame
 
 
         public const string SHOP_BUY = "SHOP_BUY";
         public const string SHOP_BUY = "SHOP_BUY";
 
 
+        public const string LUCKY_BOX = "LUCKY_BOX";
+
     }
     }
 }
 }

+ 56 - 95
GameClient/Assets/Game/HotUpdate/Data/Cache/LuckyBoxBonusDataCache.cs

@@ -23,21 +23,11 @@ namespace GFGGame
                 }
                 }
             }
             }
         }
         }
-        public static int currentSelectId
-        {
-            get
-            {
-                return _currentSelectId;
-            }
-            set
-            {
-                _currentSelectId = value;
-            }
-        }
+
         public static string probShow;
         public static string probShow;
         private static List<LuckyBoxBonusData> _showList;
         private static List<LuckyBoxBonusData> _showList;
-        private static int _dropOutId;
-        private static int _dropId;
+        // private static int _dropOutId;
+        // private static int _dropId;
 
 
         public static int GetOwnedCount()
         public static int GetOwnedCount()
         {
         {
@@ -60,68 +50,68 @@ namespace GFGGame
             return _showList.GetRange(0, _showList.Count);
             return _showList.GetRange(0, _showList.Count);
         }
         }
 
 
-        public static List<ItemData> GetBonusList(int count, bool isGuide = false)
-        {
-            List<ItemData> bonusList = null;
-            if (isGuide)
-            {
-                int[][] temp = new int[5][];
-                temp[0] = new int[] { 10332, 1 };
-                temp[1] = new int[] { 10334, 1 };
-                temp[2] = new int[] { 10335, 1 };
-                temp[3] = new int[] { 10336, 1 };
-                temp[4] = new int[] { 10338, 1 };
-                List<ItemData> guideBonusList = ItemUtil.CreateItemDataList(temp);
-                count = count - guideBonusList.Count;
-                bonusList = DropOutDataCache.GetDropItemDatas(_dropOutId, count);
-                while (guideBonusList.Count > 1)
-                {
-                    ItemData itemData = guideBonusList[0];
-                    guideBonusList.RemoveAt(0);
-                    int index = UnityEngine.Random.Range(0, bonusList.Count);
-                    bonusList.Insert(index, itemData);
-                }
-                bonusList.Add(guideBonusList[0]);
-            }
-            else
-            {
-                bonusList = DropOutDataCache.GetDropItemDatas(_dropOutId, count);
-            }
-            int dicIndex = 0;
-            LuckyBoxDataManager.Instance.FirstRewardList.Clear();
-            foreach (ItemData itemData in bonusList)
-            {
+        // public static List<ItemData> GetBonusList(int count, bool isGuide = false)
+        // {
+        //     List<ItemData> bonusList = null;
+        //     if (isGuide)
+        //     {
+        //         int[][] temp = new int[5][];
+        //         temp[0] = new int[] { 10332, 1 };
+        //         temp[1] = new int[] { 10334, 1 };
+        //         temp[2] = new int[] { 10335, 1 };
+        //         temp[3] = new int[] { 10336, 1 };
+        //         temp[4] = new int[] { 10338, 1 };
+        //         List<ItemData> guideBonusList = ItemUtil.CreateItemDataList(temp);
+        //         count = count - guideBonusList.Count;
+        //         bonusList = DropOutDataCache.GetDropItemDatas(_dropOutId, count);
+        //         while (guideBonusList.Count > 1)
+        //         {
+        //             ItemData itemData = guideBonusList[0];
+        //             guideBonusList.RemoveAt(0);
+        //             int index = UnityEngine.Random.Range(0, bonusList.Count);
+        //             bonusList.Insert(index, itemData);
+        //         }
+        //         bonusList.Add(guideBonusList[0]);
+        //     }
+        //     else
+        //     {
+        //         bonusList = DropOutDataCache.GetDropItemDatas(_dropOutId, count);
+        //     }
+        //     int dicIndex = 0;
+        //     LuckyBoxDataManager.Instance.FirstRewardList.Clear();
+        //     foreach (ItemData itemData in bonusList)
+        //     {
 
 
-                if (ItemDataManager.GetItemNum(itemData.id) == 0)
-                {
-                    LuckyBoxDataManager.Instance.FirstRewardList.Add(dicIndex, itemData);
-                }
-                ItemDataManager.Add(itemData.id, itemData.num);
-                dicIndex++;
-            }
-            ItemDataManager.Add(_dropId, count);
+        //         if (ItemDataManager.GetItemNum(itemData.id) == 0)
+        //         {
+        //             LuckyBoxDataManager.Instance.FirstRewardList.Add(dicIndex, itemData);
+        //         }
+        //         ItemDataManager.Add(itemData.id, itemData.num);
+        //         dicIndex++;
+        //     }
+        //     ItemDataManager.Add(_dropId, count);
 
 
-            //100¸öÐÇм»»1¸öÂäÐÇʯ
-            LuckyBoxCfg boxCfg0 = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.luckyBoxIds[0]);
-            LuckyBoxCfg boxCfg1 = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.luckyBoxIds[1]);
-            int itemCount = ItemDataManager.GetItemNum(boxCfg0.drop);
-            if (_dropId == boxCfg0.drop && itemCount >= 100)
-            {
-                ItemDataManager.Add(boxCfg1.drop, itemCount / 100);
-                ItemDataManager.Remove(_dropId, itemCount / 100 * 100);
-            }
+        //     //100¸öÐÇм»»1¸öÂäÐÇʯ
+        //     LuckyBoxCfg boxCfg0 = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.luckyBoxIds[0]);
+        //     LuckyBoxCfg boxCfg1 = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.luckyBoxIds[1]);
+        //     int itemCount = ItemDataManager.GetItemNum(boxCfg0.drop);
+        //     if (_dropId == boxCfg0.drop && itemCount >= 100)
+        //     {
+        //         ItemDataManager.Add(boxCfg1.drop, itemCount / 100);
+        //         ItemDataManager.Remove(_dropId, itemCount / 100 * 100);
+        //     }
 
 
-            GetSuitItemController.TryShow(0);
-            return bonusList;
-        }
+        //     GetSuitItemController.TryShow(0);
+        //     return bonusList;
+        // }
 
 
         private static void InitData(int boxId)
         private static void InitData(int boxId)
         {
         {
             LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
             LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
             probShow = luckyBoxCfg.probShow;
             probShow = luckyBoxCfg.probShow;
             _showList = GetBonusDataList(luckyBoxCfg.bonusShowArr);
             _showList = GetBonusDataList(luckyBoxCfg.bonusShowArr);
-            _dropOutId = luckyBoxCfg.bonus;
-            _dropId = luckyBoxCfg.drop;
+            // _dropOutId = luckyBoxCfg.bonus;
+            // _dropId = luckyBoxCfg.drop;
         }
         }
 
 
         private static List<LuckyBoxBonusData> GetBonusDataList(int[] idsList)
         private static List<LuckyBoxBonusData> GetBonusDataList(int[] idsList)
@@ -139,35 +129,6 @@ namespace GFGGame
             return list;
             return list;
         }
         }
 
 
-        public static void CheckItemEnough(int itemId, int count, int times, Action onSuccess)
-        {
-            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
-            int hasNum = ItemDataManager.GetItemNum(itemCfg.id);
-            if (hasNum >= count)//????
-            {
-                Alert.Show(string.Format("是否花费{0}个{1}摘星{2}次?", count, itemCfg.name, times)).SetLeftButton(true).SetRightButton(true, "确定", (object data) => { onSuccess(); });
-            }
-            else
-            {
 
 
-                ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(itemId, ItemDataManager.GetItemExchangeTimes(itemId), count, out int costId, out int costNeedNum, out int buyNum);
-                int costHasNum = ItemDataManager.GetItemNum(costId);
-                if (costHasNum >= costNeedNum)
-                {
-                    if (itemId == ConstItemID.GOLD)
-                    {
-                        ItemUtil.ExchangeItemById(itemId, count - hasNum, false, onSuccess);
-                    }
-                    else
-                    {
-                        BuyTipsController.Show(itemId, count - hasNum, onSuccess);
-                    }
-                }
-                else
-                {
-                    ItemUtil.ExchangeItemById(costId, costNeedNum - costHasNum, true, null, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED, true);
-                }
-            }
-        }
     }
     }
 }
 }

+ 66 - 2
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -1,4 +1,5 @@
-using System.Collections;
+using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine;
 
 
@@ -11,6 +12,8 @@ namespace GFGGame
         public const int BOX_ID_2 = 2;
         public const int BOX_ID_2 = 2;
         public const int BOX_ID_3 = 3;
         public const int BOX_ID_3 = 3;
 
 
+        public const int ONCE_TIME = 1;
+        public const int TEN_TIME = 10;
 
 
         private List<ItemData> _rewardsList;//当前奖励,每次抽奖后刷新
         private List<ItemData> _rewardsList;//当前奖励,每次抽奖后刷新
         private Dictionary<int, ItemData> _firstRewardsList = new Dictionary<int, ItemData>();//首次获得的奖励
         private Dictionary<int, ItemData> _firstRewardsList = new Dictionary<int, ItemData>();//首次获得的奖励
@@ -20,7 +23,20 @@ namespace GFGGame
         public List<ItemData> RewardList
         public List<ItemData> RewardList
         {
         {
             get { return _rewardsList; }
             get { return _rewardsList; }
-            set { _rewardsList = value; }
+            set
+            {
+                _rewardsList = value;
+                _firstRewardsList.Clear();
+                int dicIndex = 0;
+                foreach (ItemData itemData in _rewardsList)
+                {
+                    if (ItemDataManager.GetItemNum(itemData.id) == 1)
+                    {
+                        _firstRewardsList.Add(dicIndex, itemData);
+                    }
+                    dicIndex++;
+                }
+            }
 
 
         }
         }
         public Dictionary<int, ItemData> FirstRewardList
         public Dictionary<int, ItemData> FirstRewardList
@@ -38,5 +54,53 @@ namespace GFGGame
             List<ItemData> cardList = new List<ItemData>(cardArray);
             List<ItemData> cardList = new List<ItemData>(cardArray);
             return cardList;
             return cardList;
         }
         }
+
+        public void CheckItemEnough(int boxId, int times, Action onSuccess)
+        {
+            int costId = LuckyBoxCfgArray.Instance.GetCfg(boxId).costID;
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(costId);
+            int costNum = GetCostNum(boxId, times);
+            int hasNum = ItemDataManager.GetItemNum(itemCfg.id);
+            if (hasNum >= costNum)
+            {
+                Alert.Show(string.Format("是否花费{0}个{1}摘星{2}次?", costNum, itemCfg.name, times)).SetLeftButton(true).SetRightButton(true, "确定", (object data) => { onSuccess(); });
+            }
+            else
+            {
+                int needNum = costNum - hasNum;
+                ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(costId, ItemDataManager.GetItemExchangeTimes(costId), needNum, out int costItemId, out int costItemNeedNum, out int buyNum);
+                int costHasNum = ItemDataManager.GetItemNum(costItemId);
+                if (costHasNum >= costItemNeedNum)//购买消耗品的道具足够,提示购买
+                {
+                    if (costId == ConstItemID.GOLD)
+                    {
+                        ItemUtil.ExchangeItemById(costId, needNum, false, onSuccess);
+                    }
+                    else
+                    {
+                        BuyTipsController.Show(costId, needNum, onSuccess);
+                    }
+                }
+                else//购买消耗品的道具不足,提示购买 购买消耗品的道具
+                {
+                    ItemUtil.ExchangeItemById(costItemId, needNum, true, null, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED, true);
+                }
+            }
+        }
+
+        private int GetCostNum(int boxId, int times)
+        {
+            LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
+            if (times == LuckyBoxDataManager.ONCE_TIME)
+            {
+                return cfg.costNum;
+            }
+            else if (times == LuckyBoxDataManager.TEN_TIME)
+            {
+                return cfg.costNumTen;
+            }
+            return 0;
+        }
+
     }
     }
 }
 }

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

@@ -12,7 +12,7 @@ namespace GFGGame
             {
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
-                    ItemDataManager.InitItemExchange(response.ItemId, response.Times);
+                    ItemDataManager.InitItemExchange(response.ItemId, response.ExchangedTimes);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
                     return true;
                     return true;
                 }
                 }

+ 26 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/LuckyBoxSProxy.cs

@@ -0,0 +1,26 @@
+using ET;
+
+namespace GFGGame
+{
+    public class LuckyBoxSProxy
+    {
+
+        //抽奖
+        public static async ETTask<bool> ReqGetBonus(int luckyBoxId, int times)
+        {
+            M2C_DrawLuckyBox response = null;
+            response = (M2C_DrawLuckyBox)await MessageHelper.SendToServer(new C2M_DrawLuckyBox() { LuckyBoxId = luckyBoxId, Times = times });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    
+                    LuckyBoxDataManager.Instance.RewardList = ItemUtil.CreateItemDataList(response.bonusList);
+                    // EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX);
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/LuckyBoxSProxy.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3203f5e673bac4e4ab7968da3f86f081
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 10 - 1
GameClient/Assets/Game/HotUpdate/Utils/ItemUtil.cs

@@ -101,7 +101,16 @@ namespace GFGGame
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
             return itemCfg.rarity;
             return itemCfg.rarity;
         }
         }
-
+        public static List<ItemData> CreateItemDataList(List<ItemInfoProto> items)
+        {
+            List<ItemData> itemList = new List<ItemData>();
+            for (int i = 0; i < items.Count; i++)
+            {
+                ItemData itemData = createItemData(items[i].ConfigId, items[i].Count);
+                itemList.Add(itemData);
+            }
+            return itemList;
+        }
         public static List<ItemData> CreateItemDataList(int[][] bonus, bool isOnceBonus = false)
         public static List<ItemData> CreateItemDataList(int[][] bonus, bool isOnceBonus = false)
         {
         {
             List<ItemData> itemList = new List<ItemData>();
             List<ItemData> itemList = new List<ItemData>();

+ 4 - 4
GameClient/Assets/Game/HotUpdate/Views/ClothingShop/ClothingShopView.cs

@@ -208,13 +208,13 @@ namespace GFGGame
         {
         {
             int luckyBoxId1 = LuckyBoxDataManager.BOX_ID_3;
             int luckyBoxId1 = LuckyBoxDataManager.BOX_ID_3;
             LuckyBoxCfg luckyBoxCfg1 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId1);
             LuckyBoxCfg luckyBoxCfg1 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId1);
-            _ui.m_txtCount0.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg1.drop);
-            _ui.m_loaIcon0.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg1.drop).res);
+            _ui.m_txtCount0.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg1.bonusArr[0][0]);
+            _ui.m_loaIcon0.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg1.bonusArr[0][0]).res);
 
 
             int luckyBoxId2 = LuckyBoxDataManager.BOX_ID_2;
             int luckyBoxId2 = LuckyBoxDataManager.BOX_ID_2;
             LuckyBoxCfg luckyBoxCfg2 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId2);
             LuckyBoxCfg luckyBoxCfg2 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId2);
-            _ui.m_txtCount1.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg2.drop);
-            _ui.m_loaIcon1.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg2.drop).res);
+            _ui.m_txtCount1.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg2.bonusArr[0][0]);
+            _ui.m_loaIcon1.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg2.bonusArr[0][0]).res);
         }
         }
         private void UpdateRole(bool tween)
         private void UpdateRole(bool tween)
         {
         {

+ 4 - 4
GameClient/Assets/Game/HotUpdate/Views/Common/Controller/ValueBarController.cs

@@ -106,13 +106,13 @@ namespace GFGGame
         {
         {
             int luckyBoxId1 = LuckyBoxDataManager.BOX_ID_2;
             int luckyBoxId1 = LuckyBoxDataManager.BOX_ID_2;
             LuckyBoxCfg luckyBoxCfg1 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId1);
             LuckyBoxCfg luckyBoxCfg1 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId1);
-            _valueBar.m_btnCJLuoXing.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg1.drop);
-            _valueBar.m_btnCJLuoXing.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg1.drop).res);
+            _valueBar.m_btnCJLuoXing.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg1.bonusArr[0][0]);
+            _valueBar.m_btnCJLuoXing.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg1.bonusArr[0][0]).res);
 
 
             int luckyBoxId2 = LuckyBoxDataManager.BOX_ID_1;
             int luckyBoxId2 = LuckyBoxDataManager.BOX_ID_1;
             LuckyBoxCfg luckyBoxCfg2 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId2);
             LuckyBoxCfg luckyBoxCfg2 = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId2);
-            _valueBar.m_btnCJHuoDong.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg2.drop);
-            _valueBar.m_btnCJHuoDong.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg2.drop).res);
+            _valueBar.m_btnCJHuoDong.text = "" + ItemDataManager.GetItemNum(luckyBoxCfg2.bonusArr[0][0]);
+            _valueBar.m_btnCJHuoDong.icon = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg2.bonusArr[0][0]).res);
 
 
 
 
         }
         }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyConfirmView.cs

@@ -70,7 +70,7 @@ namespace GFGGame
         }
         }
         private async void OnClickBtnSure()
         private async void OnClickBtnSure()
         {
         {
-            if (_maxTimes > 0 && (_buyTimes + _count) >= _maxTimes)
+            if (_maxTimes > 0 && (_buyTimes + _count) > _maxTimes)
             {
             {
                 PromptController.Instance.ShowFloatTextPrompt("购买次数不足!");
                 PromptController.Instance.ShowFloatTextPrompt("购买次数不足!");
                 return;
                 return;

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxStarView.cs

@@ -209,6 +209,7 @@ namespace GFGGame
             {
             {
 
 
                 RemoveListener();
                 RemoveListener();
+                GetSuitItemController.TryShow(0);
                 ViewManager.Show(ViewName.LUCKY_BOX_CARD_VIEW, new object[] { _rewardList, FirstGetCardViewType.JUMP });
                 ViewManager.Show(ViewName.LUCKY_BOX_CARD_VIEW, new object[] { _rewardList, FirstGetCardViewType.JUMP });
                 this.Hide();
                 this.Hide();
             }
             }

+ 18 - 38
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -24,6 +24,7 @@ namespace GFGGame
 
 
         private bool isActiveBoxOpen = false;
         private bool isActiveBoxOpen = false;
 
 
+
         public override void Dispose()
         public override void Dispose()
         {
         {
             _valueBarController.Dispose();
             _valueBarController.Dispose();
@@ -80,8 +81,9 @@ namespace GFGGame
             LuckyBoxBonusDataCache.currentBoxId = boxId;
             LuckyBoxBonusDataCache.currentBoxId = boxId;
             isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
             isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
 
 
+            int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxBonusDataCache.currentBoxId);
             _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
             _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
-            _ui.m_listBg.ScrollToView(Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxBonusDataCache.currentBoxId));
+            _ui.m_listBg.ScrollToView(index);
             _ui.m_listBg.scrollPane.decelerationRate = 0.8f;
             _ui.m_listBg.scrollPane.decelerationRate = 0.8f;
 
 
             Timers.inst.Add(1, 0, CheckTime);
             Timers.inst.Add(1, 0, CheckTime);
@@ -90,7 +92,8 @@ namespace GFGGame
             _valueBarController.Controller(4);
             _valueBarController.Controller(4);
 
 
             onClickChange(0);
             onClickChange(0);
-            updateActiveBox();
+            updateBoxEffect();
+            UpdateNormal();
         }
         }
 
 
         private void RenderListBgItem(int index, GObject obj)
         private void RenderListBgItem(int index, GObject obj)
@@ -101,7 +104,6 @@ namespace GFGGame
         }
         }
         private void CheckTime(object param = null)
         private void CheckTime(object param = null)
         {
         {
-            // int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1);
             if (!isActiveBoxOpen)
             if (!isActiveBoxOpen)
             {
             {
                 //活动未开启
                 //活动未开启
@@ -115,15 +117,13 @@ namespace GFGGame
         }
         }
         private void OnListBgScroll()
         private void OnListBgScroll()
         {
         {
-            // if (_ui.m_c1.selectedIndex == -1 || _ui.m_listBg.numChildren <= 0) return;
-
             UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(_ui.m_c1.selectedIndex));
             UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(_ui.m_c1.selectedIndex));
             LuckyBoxBonusDataCache.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[_ui.m_c1.selectedIndex];
             LuckyBoxBonusDataCache.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[_ui.m_c1.selectedIndex];
             item.m_txtTime.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_txtTime.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_imgTitle.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_imgTitle.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
-            item.m_loaImg.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_3;
             item.m_holder.visible = isActiveBoxOpen && LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_holder.visible = isActiveBoxOpen && LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_holder1.visible = isActiveBoxOpen && LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_holder1.visible = isActiveBoxOpen && LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
+            item.m_loaImg.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_3;
 
 
             onClickChange(0);
             onClickChange(0);
             UpdateNormal();
             UpdateNormal();
@@ -134,7 +134,6 @@ namespace GFGGame
             LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxBonusDataCache.currentBoxId);
             LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxBonusDataCache.currentBoxId);
             _valueBarController.UpdateCJ(LuckyBoxBonusDataCache.currentBoxId);
             _valueBarController.UpdateCJ(LuckyBoxBonusDataCache.currentBoxId);
 
 
-
             _ui.m_comCostOne.m_txtCost.text = luckyBoxCfg.costNum.ToString();
             _ui.m_comCostOne.m_txtCost.text = luckyBoxCfg.costNum.ToString();
             _ui.m_comCostTen.m_txtCost.text = luckyBoxCfg.costNumTen.ToString();
             _ui.m_comCostTen.m_txtCost.text = luckyBoxCfg.costNumTen.ToString();
             _ui.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg.costID).res);
             _ui.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(luckyBoxCfg.costID).res);
@@ -156,7 +155,7 @@ namespace GFGGame
             _ui.m_btnBuyTen.m_holder.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             _ui.m_btnBuyTen.m_holder.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
         }
         }
 
 
-        private void updateActiveBox()
+        private void updateBoxEffect()
         {
         {
             if (isActiveBoxOpen)
             if (isActiveBoxOpen)
             {
             {
@@ -185,45 +184,26 @@ namespace GFGGame
         }
         }
         private void OnClickBtnBuyOne()
         private void OnClickBtnBuyOne()
         {
         {
-            LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxBonusDataCache.currentBoxId);
-            LuckyBoxBonusDataCache.CheckItemEnough(luckyBoxCfg.costID, luckyBoxCfg.costNum, 1, () =>
+            LuckyBoxDataManager.Instance.CheckItemEnough(LuckyBoxBonusDataCache.currentBoxId, LuckyBoxDataManager.ONCE_TIME, async () =>
              {
              {
-                 ItemDataManager.Remove(luckyBoxCfg.costID, luckyBoxCfg.costNum);
-                 LuckyBoxDataManager.Instance.RewardList = LuckyBoxBonusDataCache.GetBonusList(1);
-                 ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxBonusDataCache.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxBonusDataCache.currentBoxId });
+                 bool result = await LuckyBoxSProxy.ReqGetBonus(LuckyBoxBonusDataCache.currentBoxId, LuckyBoxDataManager.ONCE_TIME);
+                 if (result)
+                 {
+                     ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxBonusDataCache.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxBonusDataCache.currentBoxId });
+                 }
              });
              });
-
         }
         }
 
 
         private void OnClickBtnBuyTen()
         private void OnClickBtnBuyTen()
         {
         {
-            // bool result = GuideController.TryCompleteGuide(ConstGuideId.MAIN_UI_BTN_ZHAI_XING);
-            LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxBonusDataCache.currentBoxId);
-            if (GuideDataManager.GetGuideCountCopy(ConstGuideId.LUCKY_BOX) <= 0)
+            LuckyBoxDataManager.Instance.CheckItemEnough(LuckyBoxBonusDataCache.currentBoxId, LuckyBoxDataManager.TEN_TIME, async () =>
             {
             {
-
-                int count = ItemDataManager.GetItemNum(luckyBoxCfg.costID);
-                if (count < luckyBoxCfg.costNumTen)
+                bool result = await LuckyBoxSProxy.ReqGetBonus(LuckyBoxBonusDataCache.currentBoxId, LuckyBoxDataManager.TEN_TIME);
+                if (result)
                 {
                 {
-                    ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(luckyBoxCfg.costID);
-                    PromptController.Instance.ShowFloatTextPrompt(itemCfg.name + "不足");
-                    return;
+                    ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxBonusDataCache.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxBonusDataCache.currentBoxId });
                 }
                 }
-                ItemDataManager.Remove(luckyBoxCfg.costID, luckyBoxCfg.costNumTen);
-                LuckyBoxDataManager.Instance.RewardList = LuckyBoxBonusDataCache.GetBonusList(10, true);
-                ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxBonusDataCache.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxBonusDataCache.currentBoxId });
-            }
-            else
-            {
-                //判断消耗
-                LuckyBoxBonusDataCache.CheckItemEnough(luckyBoxCfg.costID, luckyBoxCfg.costNumTen, 10, () =>
-                 {
-                     ItemDataManager.Remove(luckyBoxCfg.costID, luckyBoxCfg.costNumTen);
-                     LuckyBoxDataManager.Instance.RewardList = LuckyBoxBonusDataCache.GetBonusList(10, false);
-                     ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxBonusDataCache.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxBonusDataCache.currentBoxId });
-
-                 });
-            }
+            });
         }
         }