Эх сурвалжийг харах

马蹄金监控输入设置上限判断

hexiaojie 2 жил өмнө
parent
commit
a87cfa09d5

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

@@ -266,14 +266,18 @@ namespace GFGGame
         private void OnChangedTxtCount(EventContext context)
         {
             GTextInput sender = context.sender as GTextInput;
-            Debug.Log(sender.text);
             bool isNumeric = int.TryParse(sender.text, out var result);
             if (!isNumeric)
             {
-                sender.text = "0";
+                sender.text = _minBuyCount.ToString();
             }
 
-            _count = Convert.ToInt32(sender.text);
+            if (Convert.ToInt32(sender.text) <= 0)
+            {
+                sender.text = _minBuyCount.ToString();
+            }
+            
+            _count = Math.Min(_maxCanBuy, Convert.ToInt32(sender.text));
             UpdateCost();
         }