|
@@ -41,7 +41,7 @@ namespace GFGGame
|
|
/// </summary>
|
|
/// </summary>
|
|
private int _costNum;
|
|
private int _costNum;
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 最大购买量
|
|
|
|
|
|
+ /// 最大购买次数
|
|
/// </summary>
|
|
/// </summary>
|
|
private int _maxCanBuy;
|
|
private int _maxCanBuy;
|
|
// private int _perCount;
|
|
// private int _perCount;
|
|
@@ -113,8 +113,9 @@ namespace GFGGame
|
|
else if (buyType == ConstBuyType.TYPE_ITEM)
|
|
else if (buyType == ConstBuyType.TYPE_ITEM)
|
|
{
|
|
{
|
|
ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(buyId);
|
|
ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(buyId);
|
|
- int maxBuyCount = (int)Math.Floor((decimal)(ItemDataManager.GetItemNum(itemExchangeCfg.costId) / itemExchangeCfg.costNumArr[0]));
|
|
|
|
|
|
+ _count = (int)Math.Ceiling(Convert.ToDecimal(minBuyCount) / Convert.ToDecimal(itemExchangeCfg.num));
|
|
|
|
|
|
|
|
+ int maxBuyCount = (int)Math.Floor((decimal)(ItemDataManager.GetItemNum(itemExchangeCfg.costId) / itemExchangeCfg.costNumArr[0]));
|
|
_maxCanBuy = Math.Min(Math.Min(maxCount, maxBuyCount), itemExchangeCfg.maxLimit == 0 ? maxCount : itemExchangeCfg.maxLimit - ItemDataManager.GetItemExchangeTimes(buyId));
|
|
_maxCanBuy = Math.Min(Math.Min(maxCount, maxBuyCount), itemExchangeCfg.maxLimit == 0 ? maxCount : itemExchangeCfg.maxLimit - ItemDataManager.GetItemExchangeTimes(buyId));
|
|
_itemId = buyId;
|
|
_itemId = buyId;
|
|
|
|
|
|
@@ -165,8 +166,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
if (_count < _maxCanBuy)
|
|
if (_count < _maxCanBuy)
|
|
{
|
|
{
|
|
- ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(_itemId);
|
|
|
|
- _count += itemExchangeCfg != null ? itemExchangeCfg.num : 1;
|
|
|
|
|
|
+ _count += 1;
|
|
}
|
|
}
|
|
UpdateCost();
|
|
UpdateCost();
|
|
}
|
|
}
|
|
@@ -181,7 +181,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
string inputStr = _ui.m_txtCount.text.Trim();
|
|
string inputStr = _ui.m_txtCount.text.Trim();
|
|
|
|
|
|
- if (inputStr == null || int.Parse(inputStr) <= _minBuyCount)
|
|
|
|
|
|
+ if (_count <= _minBuyCount)
|
|
{
|
|
{
|
|
_ui.m_btnMinus.enabled = false;
|
|
_ui.m_btnMinus.enabled = false;
|
|
}
|
|
}
|
|
@@ -191,7 +191,7 @@ namespace GFGGame
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if (inputStr != null && (int.Parse(inputStr) >= _maxCanBuy))
|
|
|
|
|
|
+ if (_count >= _maxCanBuy)
|
|
{
|
|
{
|
|
_ui.m_btnPlus.enabled = false;
|
|
_ui.m_btnPlus.enabled = false;
|
|
_ui.m_btnAll.enabled = false;
|
|
_ui.m_btnAll.enabled = false;
|
|
@@ -209,7 +209,7 @@ namespace GFGGame
|
|
int price = int.Parse(_ui.m_txtPrice.text.Trim());
|
|
int price = int.Parse(_ui.m_txtPrice.text.Trim());
|
|
|
|
|
|
|
|
|
|
- if (count > 0)
|
|
|
|
|
|
+ if (_count > 0)
|
|
{
|
|
{
|
|
if (price > ItemDataManager.GetItemNum(_costId))
|
|
if (price > ItemDataManager.GetItemNum(_costId))
|
|
{
|
|
{
|
|
@@ -236,10 +236,10 @@ namespace GFGGame
|
|
case ConstBuyType.TYPE_NORMAL:
|
|
case ConstBuyType.TYPE_NORMAL:
|
|
break;
|
|
break;
|
|
case ConstBuyType.TYPE_ITEM:
|
|
case ConstBuyType.TYPE_ITEM:
|
|
- result = await ItemExchangeSProxy.ItemExchange(_buyId, count);
|
|
|
|
|
|
+ result = await ItemExchangeSProxy.ItemExchange(_buyId, _count);
|
|
break;
|
|
break;
|
|
case ConstBuyType.TYPE_SHOP:
|
|
case ConstBuyType.TYPE_SHOP:
|
|
- result = await ShopSProxy.ShopBuy(_shopType, _buyId, count);
|
|
|
|
|
|
+ result = await ShopSProxy.ShopBuy(_shopType, _buyId, _count);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if (_onSuccess != null)
|
|
if (_onSuccess != null)
|
|
@@ -281,7 +281,7 @@ namespace GFGGame
|
|
ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(_itemId);
|
|
ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(_itemId);
|
|
int _exchangeCount = (int)Math.Ceiling(Convert.ToDecimal(count) / Convert.ToDecimal(itemExchangeCfg.num));
|
|
int _exchangeCount = (int)Math.Ceiling(Convert.ToDecimal(count) / Convert.ToDecimal(itemExchangeCfg.num));
|
|
|
|
|
|
- ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, ItemDataManager.GetItemExchangeTimes(_itemId), _exchangeCount, out _costId, out _costNum, out _buyNum);
|
|
|
|
|
|
+ ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, ItemDataManager.GetItemExchangeTimes(_itemId), count, out _costId, out _costNum, out _buyNum);
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|