Browse Source

抽卡购买道具数量

zhaoyang 3 years ago
parent
commit
56685636f7

+ 3 - 1
FGUIProject/assets/LuckyBox/LuckBoxBonusUI.xml

@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <component size="1080,1920">
 <component size="1080,1920">
   <displayList>
   <displayList>
-    <loader id="n16_fz8v" name="loaBg" xy="540,960" pivot="0.5,0.5" anchor="true" size="1080,1920" fill="scaleMatchWidth"/>
+    <loader id="n16_fz8v" name="loaBg" xy="540,960" pivot="0.5,0.5" anchor="true" size="1080,1920" fill="scaleMatchWidth">
+      <relation target="" sidePair="width-width,height-height"/>
+    </loader>
     <component id="n1_ga16" name="item0" src="ga16g" fileName="components/LuckyBoxBonusItem.xml" pkg="eg2y0ldp" xy="360,452" group="n15_ga16"/>
     <component id="n1_ga16" name="item0" src="ga16g" fileName="components/LuckyBoxBonusItem.xml" pkg="eg2y0ldp" xy="360,452" group="n15_ga16"/>
     <component id="n5_ga16" name="item1" src="ga16g" fileName="components/LuckyBoxBonusItem.xml" pkg="eg2y0ldp" xy="718,452" group="n15_ga16"/>
     <component id="n5_ga16" name="item1" src="ga16g" fileName="components/LuckyBoxBonusItem.xml" pkg="eg2y0ldp" xy="718,452" group="n15_ga16"/>
     <component id="n6_ga16" name="item2" src="ga16g" fileName="components/LuckyBoxBonusItem.xml" pkg="eg2y0ldp" xy="182,790" group="n15_ga16"/>
     <component id="n6_ga16" name="item2" src="ga16g" fileName="components/LuckyBoxBonusItem.xml" pkg="eg2y0ldp" xy="182,790" group="n15_ga16"/>

+ 18 - 3
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -133,8 +133,23 @@ namespace GFGGame
             else
             else
             {
             {
                 int needNum = costNum - hasNum;
                 int needNum = costNum - hasNum;
-                ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(costId, ItemDataManager.GetItemExchangeTimes(costId), times, out int costItemId, out int costItemNeedNum, out int buyNum);
-                int costHasNum = ItemDataManager.GetItemNum(costItemId);
+                // ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(costId, ItemDataManager.GetItemExchangeTimes(costId), times, out int costItemId, out int costItemNeedNum, out int buyNum);
+
+                ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(costId);
+                int exchangedTimes = ItemDataManager.GetItemExchangeTimes(costId);
+                int costItemNeedNum = 0;
+                int costbuyNum = 0;
+                int buyNum = 0;
+                for (var i = exchangedTimes + 1; i <= exchangedTimes + times; i++)
+                {
+                    ItemExchangeCfgArray.Instance.GetCostAndBuyNum(itemExchangeCfg, i, out int _costNum, out int _buyNum);
+                    costItemNeedNum += _costNum;
+                    costbuyNum += _buyNum;
+                    buyNum = itemExchangeCfg.num;
+                    if (buyNum >= needNum) break;
+
+                }
+                int costHasNum = ItemDataManager.GetItemNum(itemExchangeCfg.costId);
                 if (costHasNum >= costItemNeedNum)//购买消耗品的道具足够,提示购买
                 if (costHasNum >= costItemNeedNum)//购买消耗品的道具足够,提示购买
                 {
                 {
                     if (costId == ConstItemID.GOLD)
                     if (costId == ConstItemID.GOLD)
@@ -148,7 +163,7 @@ namespace GFGGame
                 }
                 }
                 else//购买消耗品的道具不足,提示购买 购买消耗品的道具
                 else//购买消耗品的道具不足,提示购买 购买消耗品的道具
                 {
                 {
-                    ItemUtil.ExchangeItemById(costItemId, costItemNeedNum - costHasNum, true, null, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED, true);
+                    ItemUtil.ExchangeItemById(itemExchangeCfg.costId, costItemNeedNum - costHasNum, true, null, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED, true);
                 }
                 }
             }
             }
         }
         }

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