|
@@ -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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|