zhaoyang 3 жил өмнө
parent
commit
3684e83d65

+ 4 - 4
FGUIProject/assets/LuckyBox/LuckyBoxStarUI.xml

@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="1080,1920">
-  <controller name="ctrlBuyType" alias="购买类型" pages="0,,1," selected="1">
+  <controller name="ctrlBuyType" alias="购买类型" pages="0,,1," selected="0">
     <remark page="0" value="买一次"/>
     <remark page="1" value="买十次"/>
   </controller>
-  <controller name="ctrlRewardsType" alias="奖池类型" pages="0,,1,,2," selected="1"/>
+  <controller name="ctrlRewardsType" alias="奖池类型" pages="0,,1,,2," selected="2"/>
   <displayList>
-    <loader id="n0_l5nz" name="bg" xy="0,-240" size="1080,2400" url="ui://drx9d1uso1391i" autoSize="true">
+    <loader id="n0_l5nz" name="bg" xy="0,-240" size="1080,2400" url="ui://drx9d1uso1391g" autoSize="true">
       <gearIcon controller="ctrlRewardsType" pages="0,1,2" values="ui://drx9d1uso1391h|ui://drx9d1uso1391i|ui://drx9d1uso1391g"/>
       <relation target="" sidePair="center-center,middle-middle"/>
     </loader>
-    <component id="n9_l5nz" name="btnBack" src="9xlo8" fileName="components/ButtonBack1.xml" pkg="eg2y0ldp" xy="72,76" visible="false"/>
+    <component id="n9_l5nz" name="btnBack" src="9xlo8" fileName="components/ButtonBack1.xml" pkg="eg2y0ldp" xy="72,76"/>
     <component id="n20_f5bl" name="comStar0_0_0" src="l5nzq" fileName="components/ComStar.xml" xy="513,889">
       <gearDisplay controller="ctrlBuyType" pages="0"/>
       <gearDisplay2 controller="ctrlRewardsType" pages="0" condition="0"/>

+ 5 - 5
GameClient/Assets/Game/HotUpdate/Controller/BonusController.cs

@@ -8,19 +8,19 @@ namespace GFGGame
 {
     public class BonusController
     {
-        public static void TryShowBonusList(int[][] bonusInfos)
+        public static void TryShowBonusList(int[][] bonusInfos, Action onSuccess = null)
         {
             if (bonusInfos != null && bonusInfos.Length > 0)
             {
                 List<ItemData> bonusList = ItemUtil.CreateItemDataList(bonusInfos);
-                ViewManager.Show<RewardView>(bonusList);
+                ViewManager.Show<RewardView>(new object[] { bonusList, onSuccess });
             }
         }
-        public static void TryShowBonusList(List<ItemData> bonusList)
+        public static void TryShowBonusList(List<ItemData> bonusList, Action onSuccess = null)
         {
-            if(bonusList != null && bonusList.Count > 0)
+            if (bonusList != null && bonusList.Count > 0)
             {
-                ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
+                ViewManager.Show<RewardView>(new object[] { bonusList, onSuccess });
             }
         }
     }

+ 0 - 74
GameClient/Assets/Game/HotUpdate/Data/Cache/LuckyBoxBonusDataCache.cs

@@ -1,74 +0,0 @@
-// using System.Collections.Generic;
-// using UnityEngine;
-// using System;
-
-// namespace GFGGame
-// {
-//     public class LuckyBoxBonusDataCache
-//     {
-//         private static int _currentBoxId;
-//         private static int _currentSelectId;
-//         public static int currentBoxId
-//         {
-//             get
-//             {
-//                 return _currentBoxId;
-//             }
-//             set
-//             {
-//                 if (_currentBoxId != value)
-//                 {
-//                     _currentBoxId = value;
-//                     InitData(_currentBoxId);
-//                 }
-//             }
-//         }
-
-//         public static string probShow;
-//         private static List<LuckyBoxBonusData> _showList;
-
-//         public static int GetOwnedCount()
-//         {
-//             int count = 0;
-//             foreach (LuckyBoxBonusData luckyBoxBonusData in _showList)
-//             {
-//                 foreach (ItemData itemData in luckyBoxBonusData.itemList)
-//                 {
-//                     if (ItemDataManager.GetItemNum(itemData.id) > 0)
-//                     {
-//                         count++;
-//                     }
-//                 }
-//             }
-//             return count;
-//         }
-
-//         public static List<LuckyBoxBonusData> GetCurrentShowList()
-//         {
-//             return _showList.GetRange(0, _showList.Count);
-//         }
-
-//         private static void InitData(int boxId)
-//         {
-//             LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
-//             probShow = luckyBoxCfg.probShow;
-//             _showList = GetBonusDataList(luckyBoxCfg.bonusShowArr);
-
-//         }
-
-//         private static List<LuckyBoxBonusData> GetBonusDataList(int[] idsList)
-//         {
-//             List<LuckyBoxBonusData> list = new List<LuckyBoxBonusData>();
-//             foreach (int id in idsList)
-//             {
-//                 BonusListCfg bonusListCfg = BonusListCfgArray.Instance.GetCfg(id);
-//                 LuckyBoxBonusData luckyBoxBonusData = new LuckyBoxBonusData();
-//                 luckyBoxBonusData.id = id;
-//                 luckyBoxBonusData.name = bonusListCfg.name;
-//                 luckyBoxBonusData.itemList = ItemUtil.CreateItemDataList(bonusListCfg.bonusListArr);
-//                 list.Add(luckyBoxBonusData);
-//             }
-//             return list;
-//         }
-//     }
-// }

+ 0 - 11
GameClient/Assets/Game/HotUpdate/Data/Cache/LuckyBoxBonusDataCache.cs.meta

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

+ 17 - 19
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -42,16 +42,14 @@ namespace GFGGame
                     dicIndex++;
                 }
             }
-
         }
         public Dictionary<int, ItemData> FirstRewardList
         {
             get { return _firstRewardsList; }
             set { _firstRewardsList = value; }
-
         }
+
         private int _currentBoxId;
-        private int _currentSelectId;
         public int currentBoxId
         {
             get
@@ -74,7 +72,20 @@ namespace GFGGame
             _showList = GetBonusDataList(luckyBoxCfg.bonusShowArr);
 
         }
-
+        private List<LuckyBoxBonusData> GetBonusDataList(int[] idsList)
+        {
+            List<LuckyBoxBonusData> list = new List<LuckyBoxBonusData>();
+            foreach (int id in idsList)
+            {
+                BonusListCfg bonusListCfg = BonusListCfgArray.Instance.GetCfg(id);
+                LuckyBoxBonusData luckyBoxBonusData = new LuckyBoxBonusData();
+                luckyBoxBonusData.id = id;
+                luckyBoxBonusData.name = bonusListCfg.name;
+                luckyBoxBonusData.itemList = ItemUtil.CreateItemDataList(bonusListCfg.bonusListArr);
+                list.Add(luckyBoxBonusData);
+            }
+            return list;
+        }
 
         public int GetOwnedCount()
         {
@@ -97,20 +108,7 @@ namespace GFGGame
             return _showList.GetRange(0, _showList.Count);
         }
 
-        private List<LuckyBoxBonusData> GetBonusDataList(int[] idsList)
-        {
-            List<LuckyBoxBonusData> list = new List<LuckyBoxBonusData>();
-            foreach (int id in idsList)
-            {
-                BonusListCfg bonusListCfg = BonusListCfgArray.Instance.GetCfg(id);
-                LuckyBoxBonusData luckyBoxBonusData = new LuckyBoxBonusData();
-                luckyBoxBonusData.id = id;
-                luckyBoxBonusData.name = bonusListCfg.name;
-                luckyBoxBonusData.itemList = ItemUtil.CreateItemDataList(bonusListCfg.bonusListArr);
-                list.Add(luckyBoxBonusData);
-            }
-            return list;
-        }
+
         //获取首次获得的服装的列表
         public List<ItemData> GetFirstClothingList()
         {
@@ -149,7 +147,7 @@ namespace GFGGame
                 }
                 else//购买消耗品的道具不足,提示购买 购买消耗品的道具
                 {
-                    ItemUtil.ExchangeItemById(costItemId, needNum, true, null, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED, true);
+                    ItemUtil.ExchangeItemById(costItemId, costItemNeedNum - costHasNum, true, null, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED, true);
                 }
             }
         }

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

@@ -109,7 +109,7 @@ namespace GFGGame
             if (allRewardList.Count > 0)
             {
 
-                ViewManager.Show<RewardView>(allRewardList);
+                BonusController.TryShowBonusList(allRewardList);
                 EventAgent.DispatchEvent(ConstMessage.MAIL_CHANGE);
             }
             else

+ 9 - 14
GameClient/Assets/Game/HotUpdate/Utils/ItemUtil.cs

@@ -70,19 +70,6 @@ namespace GFGGame
             BuyItemConteoller.showTxtBuyTips = true;
         }
 
-        /// <summary>
-        /// 添加物品,会消耗物品
-        /// </summary>
-        /// <param name="addId"></param>
-        /// <param name="addNum"></param>
-        /// <param name="costId"></param>
-        /// <param name="costNum"></param>
-        public static void AddItemUseCost(int addId, int addNum, int costId, int costNum)
-        {
-            ItemDataManager.Add(addId, addNum);
-            ItemDataManager.Remove(costId, costNum);
-            GetSuitItemController.TryShow(0);
-        }
 
         public static string GetItemName(int itemId)
         {
@@ -122,7 +109,13 @@ namespace GFGGame
             }
             return itemList;
         }
-
+        public static List<ItemData> CreateItemDataList(int itemId, int count)
+        {
+            List<ItemData> itemList = new List<ItemData>();
+            ItemData itemData = createItemData(itemId, count);
+            itemList.Add(itemData);
+            return itemList;
+        }
         public static ItemData createItemData(int[] bonus)
         {
             int itemID = bonus[0];
@@ -134,6 +127,8 @@ namespace GFGGame
             return createItemData(itemID, itemNum);
         }
 
+
+
         public static ItemData createItemData(int itemId, int count)
         {
             ItemData itemData = ItemDataPool.GetItemData(itemId);

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingDecompose/ClothingDecomposeView.cs

@@ -260,7 +260,7 @@ namespace GFGGame
                 ItemDataManager.Add(itemData.id, itemData.num);
             }
 
-            ViewManager.Show<RewardView>(listReward);
+            BonusController.TryShowBonusList(listReward);
             OnClickBtnRarity(_curRarity);
         }
         private void OnClickBtnRule()

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/SuitRenewFinishView.cs

@@ -41,7 +41,8 @@ namespace GFGGame
             base.OnHide();
 
             SuitFosterListCfg cfg = SuitFosterListCfgArray.Instance.GetCfg(_suitId);
-            ViewManager.Show<RewardView>(ItemUtil.CreateItemDataList(cfg.renewRewardsArr));
+            BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(cfg.renewRewardsArr));
+
 
         }
     }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/SuitView.cs

@@ -258,7 +258,7 @@ namespace GFGGame
         private void OnListenerGetFosterReward(EventContext context)
         {
             SuitFosterCfg cfg = SuitFosterCfgArray.Instance.GetCfgs(_suitId)[(int)(context.data) - 1];
-            ViewManager.Show<RewardView>(ItemUtil.CreateItemDataList(cfg.rewardsArr));
+            BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(cfg.rewardsArr));
             UpdateFosterReward();
             Debug.Log("养护奖励:" + ItemDataManager.GetItemNum(100169));
 

+ 5 - 11
GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyTipsView.cs

@@ -12,6 +12,7 @@ namespace GFGGame
         private int _costId;
         private int _count;
         private int _costCount;
+        private bool _result = false;
         private Action _onSuccess;
 
         public override void Dispose()
@@ -35,8 +36,7 @@ namespace GFGGame
         {
             _itemId = itemId;
             _count = count;
-            // _costId = costId;
-            // _costCount = costCount;
+
             _onSuccess = onSuccess;
         }
         protected override void OnShown()
@@ -56,16 +56,10 @@ namespace GFGGame
         private async void OnClickBtnSure()
         {
 
-            bool result = await ItemExchangeSProxy.ItemExchange(_itemId, _count);
-            if (result)
+            _result = await ItemExchangeSProxy.ItemExchange(_itemId, _count);
+            if (_result)
             {
-                ItemData itemData = ItemUtil.createItemData(_itemId, _count); ;//new ItemData();
-
-                ViewManager.Show<RewardView>(itemData);
-                if (_onSuccess != null)
-                {
-                    _onSuccess();
-                }
+                BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(_itemId, _count), _onSuccess);
             }
 
             this.Hide();

+ 21 - 2
GameClient/Assets/Game/HotUpdate/Views/CommonGame/RewardView.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 using UI.CommonGame;
 using FairyGUI;
 using System.Collections.Generic;
+using System;
 
 namespace GFGGame
 {
@@ -11,7 +12,7 @@ namespace GFGGame
         private UI_RewardUI _ui;
         private List<ItemData> _listItemDatas;
 
-
+        private Action onSuccess = null;
 
         public override void Dispose()
         {
@@ -35,9 +36,26 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            _listItemDatas = this.viewData as List<ItemData>;
+            if ((this.viewData as object[]).Length > 0)
+            {
+                // onSuccess
+                _listItemDatas = (this.viewData as object[])[0] as List<ItemData>;
+                onSuccess = (this.viewData as object[])[1] as Action;
+            }
+            else
+            {
+                _listItemDatas = this.viewData as List<ItemData>;
+            }
             _ui.m_listReward.numItems = _listItemDatas.Count;
         }
+        protected override void OnHide()
+        {
+            if (onSuccess != null)
+            {
+                onSuccess();
+            }
+            base.OnHide();
+        }
         private void RenderListRewardItem(int index, GObject obj)
         {
             obj.data = _listItemDatas[index];
@@ -67,5 +85,6 @@ namespace GFGGame
             get { return _showTips; }
             set { _showTips = value; }
         }
+
     }
 }

+ 1 - 2
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxBonusView.cs

@@ -64,9 +64,8 @@ namespace GFGGame
         private void OnClickBg()
         {
             this.Hide();
-
             ViewManager.Show(ViewName.LUCKY_BOX_VIEW, ViewManager.GetGoBackDatas(ViewName.LUCKY_BOX_STAR_VIEW));
-            // ViewManager.GoBackFrom(ViewName.LUCKY_BOX_VIEW);
+            GetSuitItemController.TryShow(0);
         }
 
         private void ShowBonusList(List<ItemData> itemList)

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

@@ -91,7 +91,6 @@ namespace GFGGame
         private void OnClickBtnPass()
         {
 
-
             ViewManager.Show(ViewName.LUCKY_BOX_BONUS_VIEW, new object[] { (this.viewData as object[])[0], _rewardList });
             this.Hide();
         }

+ 2 - 3
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxStarView.cs

@@ -61,6 +61,7 @@ namespace GFGGame
             this.viewCom = _ui.target;
             isfullScreen = true;
 
+            _ui.m_btnBack.visible = true;
             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
         }
         protected override void OnShown()
@@ -72,8 +73,7 @@ namespace GFGGame
 
             _rewardList = LuckyBoxDataManager.Instance.RewardList;
             _ui.m_ctrlBuyType.selectedIndex = _rewardList != null && _rewardList.Count > 1 ? 1 : 0;
-
-            _ui.m_ctrlRewardsType.selectedIndex = Array.IndexOf(LuckyBoxCfgArray.Instance.dataArray, LuckyBoxCfgArray.Instance.GetCfg((int)viewData)); ;
+            _ui.m_ctrlRewardsType.selectedIndex = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
             isFirst = true;
             ResetStartView();
         }
@@ -209,7 +209,6 @@ namespace GFGGame
             {
 
                 RemoveListener();
-                GetSuitItemController.TryShow(0);
                 ViewManager.Show(ViewName.LUCKY_BOX_CARD_VIEW, new object[] { _rewardList, FirstGetCardViewType.JUMP });
                 this.Hide();
             }

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

@@ -189,7 +189,7 @@ namespace GFGGame
                  bool result = await LuckyBoxSProxy.ReqGetBonus(LuckyBoxDataManager.Instance.currentBoxId, LuckyBoxDataManager.ONCE_TIME);
                  if (result)
                  {
-                     ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxDataManager.Instance.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxDataManager.Instance.currentBoxId });
+                     ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, null, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxDataManager.Instance.currentBoxId });
                  }
              });
         }
@@ -201,7 +201,7 @@ namespace GFGGame
                 bool result = await LuckyBoxSProxy.ReqGetBonus(LuckyBoxDataManager.Instance.currentBoxId, LuckyBoxDataManager.TEN_TIME);
                 if (result)
                 {
-                    ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, LuckyBoxDataManager.Instance.currentBoxId, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxDataManager.Instance.currentBoxId });
+                    ViewManager.Show(ViewName.LUCKY_BOX_STAR_VIEW, null, new object[] { ViewName.LUCKY_BOX_VIEW, LuckyBoxDataManager.Instance.currentBoxId });
                 }
             });
         }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterView.cs

@@ -227,7 +227,7 @@ namespace GFGGame
                     List<ItemData> bonusList = MainStoryDataManager.GetChapterBonus(MainStoryDataManager.currentChapterCfgId, index);
                     if (bonusList != null && bonusList.Count > 0)
                     {
-                        ViewManager.Show<RewardView>(bonusList);
+                        BonusController.TryShowBonusList(bonusList);
                     }
                     UpdateBonusBoxStatus(bonusBox, index);
                 }

BIN
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_fui.bytes