Forráskód Böngészése

卡牌消耗提示

zhaoyang 2 éve
szülő
commit
6126f1c88e

+ 11 - 18
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -506,15 +506,13 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt("未选择升级材料");
                 return;
             }
-            if (itemMoneyNum > ItemDataManager.GetItemNum(itemMoneyId))
+            if (!ItemUtil.CheckItemEnough(itemMoneyId, itemMoneyNum))
             {
-                ItemUtil.AddGold(UpLv);
-            }
-            else
-            {
-                this.UpLv();
+                long has = ItemDataManager.GetItemNum(itemMoneyId);
+                ItemUtil.BuyCurrency(itemMoneyId, itemMoneyNum - has);
+                return;
             }
-
+            this.UpLv();
         }
         private async void UpLv()
         {
@@ -712,24 +710,19 @@ namespace GFGGame
                 return;
             }
 
-            int state = int.Parse(_comFosterBottom.m_btnUpStar.data.ToString());
-            if (state == 0)
+            if (!ItemUtil.CheckItemEnough(cardStarCfg.costID, cardStarCfg.costNum))
             {
-                PromptController.Instance.ShowFloatTextPrompt("材料不足");
+                long has = ItemDataManager.GetItemNum(cardStarCfg.costID);
+                ItemUtil.BuyCurrency(cardStarCfg.costID, cardStarCfg.costID - has);
                 return;
             }
-            long costHas = ItemDataManager.GetItemNum(cardStarCfg.costID);
-            int costNeed = cardStarCfg.costNum;
-            if (costHas < costNeed)
-            {
-                ItemUtil.AddGold(UpStar);
 
-            }
-            else
+            for (int i = 0; i < cardStarCfg.materiarsArr.Length; i++)
             {
-                this.UpStar();
+                if (!ItemUtil.CheckItemEnough(cardStarCfg.materiarsArr[i][0], cardStarCfg.materiarsArr[i][1], true)) return;
             }
 
+            this.UpStar();
         }
         private async void UpStar()
         {