Explorar o código

服装店消耗提示

zhaoyang %!s(int64=2) %!d(string=hai) anos
pai
achega
40ff914846

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

@@ -18,13 +18,13 @@ namespace GFGGame
         public static void ExchangeItemById(int itemId, long num, bool showTips = true, Action onSuccess = null, bool openSource = false, int maxCount = 9990, bool showTxtBuyTips = false, string prefix = "")
         {
 
-            if (!BuyCurrency(itemId, onSuccess))
+            if (!BuyCurrency(itemId, num, onSuccess))
             {
                 BuyItemConteoller.Show(itemId, num, ConstBuyType.TYPE_ITEM, onSuccess, showTips, openSource, maxCount);
                 BuyItemConteoller.showTxtBuyTips = showTxtBuyTips;
             }
         }
-        public static bool BuyCurrency(int itemId, Action onSuccess = null)
+        public static bool BuyCurrency(int itemId, long num, Action onSuccess = null)
         {
             switch (itemId)
             {
@@ -35,7 +35,7 @@ namespace GFGGame
                     AddPower();
                     return true;
                 case ConstItemID.DIAMOND_RED:
-                    AddDiamondRed();
+                    AddDiamondRed(num);
                     return true;
                 case ConstItemID.DIAMOND_PURPLE:
                     ItemUtil.AddDiamondPurple();
@@ -72,7 +72,7 @@ namespace GFGGame
         }
 
         //红钻(鲛绡)
-        public static void AddDiamondRed(int value = 0, Action onSuccess = null)
+        public static void AddDiamondRed(long value = 0, Action onSuccess = null)
         {
 
             ItemExchangeCfg currencyRatioCfg = ItemExchangeCfgArray.Instance.GetCfg(ConstItemID.DIAMOND_RED);// GetCurrencyRatioCfgById(ConstItemID.DIAMOND_RED);

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

@@ -129,12 +129,12 @@ namespace GFGGame
                 _ui.m_txtBuyTips.text = string.Format("消耗{0}{1},可兑换{2}{3}", itemExchangeCfg.costNumArr[0], itemCostCfg.name, itemExchangeCfg.num, itemCfg.name);
             }
             GetMoneyIdAndNum(minBuyCount, out _costId, out _costNum, out _buyNum);
-
+            UpdateView();
         }
         protected override void OnShown()
         {
             base.OnShown();
-            UpdateView();
+            // UpdateView();
             Timers.inst.AddUpdate(CheckGuide);
         }
         private void UpdateView()
@@ -219,14 +219,16 @@ namespace GFGGame
 
             if (_count > 0)
             {
-                if (price > ItemDataManager.GetItemNum(_costId))
+                long hasCount = ItemDataManager.GetItemNum(_costId);
+                if (price > hasCount)
                 {
-                    this.Hide();
-                    if (!ItemUtil.BuyCurrency(_costId))
+                    // this.Hide();
+                    if (!ItemUtil.BuyCurrency(_costId, price - hasCount))
                     {
                         ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId);
                         PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足", costCfg.name));
                     }
+                    return;
                 }
                 else
                 {