|
@@ -14,7 +14,7 @@ namespace GFGGame
|
|
|
/// <param name="showTxtBuyTips">是否显示购买提示</param>
|
|
|
public static void ExchangeItemById(int itemId, int num, bool showTips = true, Action onSuccess = null, bool openSource = false, int maxCount = 9990, bool showTxtBuyTips = false, string prefix = "")
|
|
|
{
|
|
|
- CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
|
|
|
+ ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
|
|
|
if (itemId == ConstItemID.GOLD)
|
|
|
{
|
|
|
AddGold(num, onSuccess);
|
|
@@ -30,15 +30,15 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static CurrencyRatioCfg GetCurrencyRatioCfgById(int itemId)
|
|
|
+ public static ExchangeCfg GetCurrencyRatioCfgById(int itemId)
|
|
|
{
|
|
|
- CurrencyRatioCfg[] currencyRatioCfgs = CurrencyRatioCfgArray.Instance.GetCfgs(itemId);
|
|
|
+ ExchangeCfg[] currencyRatioCfgs = ExchangeCfgArray.Instance.GetCfgs(itemId);
|
|
|
if (currencyRatioCfgs.Length == 0)
|
|
|
{
|
|
|
UnityEngine.Debug.LogWarning(itemId + "在h货币换算.xlsx中没有配置");
|
|
|
return null;
|
|
|
}
|
|
|
- CurrencyRatioCfg currencyRatioCfg;
|
|
|
+ ExchangeCfg currencyRatioCfg;
|
|
|
if (itemId == ConstItemID.POWER)
|
|
|
{
|
|
|
int powerBuyTimes = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerBuyTimes);
|
|
@@ -60,7 +60,7 @@ namespace GFGGame
|
|
|
}
|
|
|
public static void AddPower(string prefix = "", Action onSuccess = null)
|
|
|
{
|
|
|
- CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(ConstItemID.POWER);
|
|
|
+ ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(ConstItemID.POWER);
|
|
|
int count = GetCostItemCount(ConstItemID.POWER, currencyRatioCfg.num);
|
|
|
int powerBuyTimes = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerBuyTimes);
|
|
|
int lastBuyCount = currencyRatioCfg.maxLimit - powerBuyTimes;
|
|
@@ -79,7 +79,7 @@ namespace GFGGame
|
|
|
|
|
|
public static void AddGold(int value = 0, Action onSuccess = null)
|
|
|
{
|
|
|
- CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(ConstItemID.GOLD);
|
|
|
+ ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(ConstItemID.GOLD);
|
|
|
int count = value > 0 ? value : currencyRatioCfg.num;
|
|
|
int costCount = GetCostItemCount(ConstItemID.GOLD, count);
|
|
|
int lastBuyCount = currencyRatioCfg.maxLimit - GameGlobal.myNumericComponent.GetAsInt(NumericType.GoldBuyTimes);
|
|
@@ -112,7 +112,7 @@ namespace GFGGame
|
|
|
public static void AddDiamondRed(int value = 0, Action onSuccess = null)
|
|
|
{
|
|
|
|
|
|
- CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(ConstItemID.DIAMOND_RED);
|
|
|
+ ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(ConstItemID.DIAMOND_RED);
|
|
|
BuyItemConteoller.Show(currencyRatioCfg.id, currencyRatioCfg.costId, currencyRatioCfg.num, currencyRatioCfg.costNum, value > 0 ? value : currencyRatioCfg.num, onSuccess, true, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED);
|
|
|
BuyItemConteoller.showTxtBuyTips = true;
|
|
|
}
|
|
@@ -121,7 +121,7 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
public static int GetCostItemCount(int itemId, int count)
|
|
|
{
|
|
|
- CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
|
|
|
+ ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
|
|
|
if (currencyRatioCfg != null)
|
|
|
{
|
|
|
return (int)Math.Ceiling((decimal)count / currencyRatioCfg.num * currencyRatioCfg.costNum);
|
|
@@ -137,7 +137,7 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
public static int GetItemExChangeCount(int itemId, int costCount)
|
|
|
{
|
|
|
- CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
|
|
|
+ ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
|
|
|
if (currencyRatioCfg != null)
|
|
|
{
|
|
|
return (int)Math.Floor((decimal)costCount / currencyRatioCfg.costNum * currencyRatioCfg.num);
|