浏览代码

兑换次数优化

guodong 3 年之前
父节点
当前提交
caa421ecc4

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit fec20516bf83ae53774c9da9d6c9a7d6e0ac5fca
+Subproject commit 36bc27be1863260697ba14637b4d5aca26926e3d

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

@@ -149,7 +149,7 @@ namespace GFGGame
             }
             }
             else
             else
             {
             {
-                CurrencyRatioCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(itemId);
+                ExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(itemId);
                 int costHasNum = ItemDataManager.GetItemNum(currencyRatioCfg.costId);
                 int costHasNum = ItemDataManager.GetItemNum(currencyRatioCfg.costId);
                 int costNeedNum = ItemUtil.GetCostItemCount(itemId, count - hasNum);
                 int costNeedNum = ItemUtil.GetCostItemCount(itemId, count - hasNum);
                 if (costHasNum >= costNeedNum)
                 if (costHasNum >= costNeedNum)

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

@@ -14,7 +14,7 @@ namespace GFGGame
         /// <param name="showTxtBuyTips">是否显示购买提示</param>
         /// <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 = "")
         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)
             if (itemId == ConstItemID.GOLD)
             {
             {
                 AddGold(num, onSuccess);
                 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)
             if (currencyRatioCfgs.Length == 0)
             {
             {
                 UnityEngine.Debug.LogWarning(itemId + "在h货币换算.xlsx中没有配置");
                 UnityEngine.Debug.LogWarning(itemId + "在h货币换算.xlsx中没有配置");
                 return null;
                 return null;
             }
             }
-            CurrencyRatioCfg currencyRatioCfg;
+            ExchangeCfg currencyRatioCfg;
             if (itemId == ConstItemID.POWER)
             if (itemId == ConstItemID.POWER)
             {
             {
                 int powerBuyTimes = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerBuyTimes);
                 int powerBuyTimes = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerBuyTimes);
@@ -60,7 +60,7 @@ namespace GFGGame
         }
         }
         public static void AddPower(string prefix = "", Action onSuccess = null)
         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 count = GetCostItemCount(ConstItemID.POWER, currencyRatioCfg.num);
             int powerBuyTimes = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerBuyTimes);
             int powerBuyTimes = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerBuyTimes);
             int lastBuyCount = currencyRatioCfg.maxLimit - powerBuyTimes;
             int lastBuyCount = currencyRatioCfg.maxLimit - powerBuyTimes;
@@ -79,7 +79,7 @@ namespace GFGGame
 
 
         public static void AddGold(int value = 0, Action onSuccess = null)
         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 count = value > 0 ? value : currencyRatioCfg.num;
             int costCount = GetCostItemCount(ConstItemID.GOLD, count);
             int costCount = GetCostItemCount(ConstItemID.GOLD, count);
             int lastBuyCount = currencyRatioCfg.maxLimit - GameGlobal.myNumericComponent.GetAsInt(NumericType.GoldBuyTimes);
             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)
         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.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;
             BuyItemConteoller.showTxtBuyTips = true;
         }
         }
@@ -121,7 +121,7 @@ namespace GFGGame
         /// </summary>
         /// </summary>
         public static int GetCostItemCount(int itemId, int count)
         public static int GetCostItemCount(int itemId, int count)
         {
         {
-            CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
+            ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
             if (currencyRatioCfg != null)
             if (currencyRatioCfg != null)
             {
             {
                 return (int)Math.Ceiling((decimal)count / currencyRatioCfg.num * currencyRatioCfg.costNum);
                 return (int)Math.Ceiling((decimal)count / currencyRatioCfg.num * currencyRatioCfg.costNum);
@@ -137,7 +137,7 @@ namespace GFGGame
         /// </summary>
         /// </summary>
         public static int GetItemExChangeCount(int itemId, int costCount)
         public static int GetItemExChangeCount(int itemId, int costCount)
         {
         {
-            CurrencyRatioCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
+            ExchangeCfg currencyRatioCfg = GetCurrencyRatioCfgById(itemId);
             if (currencyRatioCfg != null)
             if (currencyRatioCfg != null)
             {
             {
                 return (int)Math.Floor((decimal)costCount / currencyRatioCfg.costNum * currencyRatioCfg.num);
                 return (int)Math.Floor((decimal)costCount / currencyRatioCfg.costNum * currencyRatioCfg.num);

+ 4 - 4
GameClient/Assets/Game/HotUpdate/Views/Common/Controller/ValueBarController.cs

@@ -46,14 +46,14 @@ namespace GFGGame
 
 
             });
             });
 
 
-            _valueBar.m_btnCJ.onClick.Add(() =>
+            _valueBar.m_btnCJ.onClick.Add((EventCallback0)(() =>
             {
             {
                 int luckyBoxId = LuckyBoxBonusDataCache.currentBoxId;
                 int luckyBoxId = LuckyBoxBonusDataCache.currentBoxId;
                 LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId);
                 LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId);
-                CurrencyRatioCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(luckyBoxCfg.costID);
-                ItemUtil.ExchangeItemById(luckyBoxCfg.costID, currencyRatioCfg != null ? currencyRatioCfg.num : 20, true);
+                ExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(luckyBoxCfg.costID);
+                ItemUtil.ExchangeItemById(luckyBoxCfg.costID, (int)(currencyRatioCfg != null ? currencyRatioCfg.num : 20), true);
 
 
-            });
+            }));
         }
         }
 
 
         public void Dispose()
         public void Dispose()

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

@@ -83,18 +83,18 @@ namespace GFGGame
                 {
                 {
 
 
                     // PromptController.Instance.ShowFloatTextPrompt(costCfg.name + "不足!");
                     // PromptController.Instance.ShowFloatTextPrompt(costCfg.name + "不足!");
-                    Alert.Show(costCfg.name + "不足,是否前往购买?").SetLeftButton(true).SetRightButton(true, "确认", (object data) =>
+                    Alert.Show(costCfg.name + "不足,是否前往购买?").SetLeftButton(true).SetRightButton(true, "确认", (AlertWindow.AlertCallback)((object data) =>
                                        {
                                        {
                                            int costNeedCount = _costCount - ItemDataManager.GetItemNum(_costId);
                                            int costNeedCount = _costCount - ItemDataManager.GetItemNum(_costId);
-                                           CurrencyRatioCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_costId);
-                                           BuyItemConteoller.Show(_costId, currencyRatioCfg.costId, currencyRatioCfg.num, currencyRatioCfg.costNum, costNeedCount, null, true, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED);
-                                       });
+                                           ExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_costId);
+                                           BuyItemConteoller.Show(_costId, (int)currencyRatioCfg.costId, (int)currencyRatioCfg.num, (int)currencyRatioCfg.costNum, costNeedCount, null, true, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED);
+                                       }));
                     OnClickBtnCancel();
                     OnClickBtnCancel();
                 }
                 }
 
 
                 return;
                 return;
             }
             }
-            CurrencyRatioCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_itemId);
+            ExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_itemId);
 
 
             // int count = (int)Math.Ceiling((decimal)_costCount / currencyRatioCfg.costNum * currencyRatioCfg.num);
             // int count = (int)Math.Ceiling((decimal)_costCount / currencyRatioCfg.costNum * currencyRatioCfg.num);
             int count = ItemUtil.GetItemExChangeCount(_itemId, _costCount);
             int count = ItemUtil.GetItemExChangeCount(_itemId, _costCount);

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

@@ -54,7 +54,7 @@ namespace GFGGame
         }
         }
         private void OnClickBtnSure()
         private void OnClickBtnSure()
         {
         {
-            CurrencyRatioCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_itemId);
+            ExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_itemId);
 
 
             int count = ItemUtil.GetItemExChangeCount(_itemId, _costCount);
             int count = ItemUtil.GetItemExChangeCount(_itemId, _costCount);
             ItemUtil.AddItemUseCost(_itemId, count, _costId, _costCount);
             ItemUtil.AddItemUseCost(_itemId, count, _costId, _costCount);

二进制
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes