浏览代码

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

hexiaojie 2 年之前
父节点
当前提交
a87cfa09d5
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyCountView.cs

+ 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();
         }