ソースを参照

调试输入框

hexiaojie 2 年 前
コミット
4bc0d4a0ba

+ 1 - 1
FGUIProject/assets/Bag/components/ListSelectorItem.xml

@@ -2,7 +2,7 @@
 <component size="172,255" overflow="hidden">
   <displayList>
     <image id="n2_v5no" name="n2" src="v5notmc" fileName="images/db_jiajian_1.png" xy="24,203"/>
-    <text id="n21_l6ko" name="txtSelNum" xy="57,200" size="60,53" font="ui://eg2y0ldpa0cftkx" fontSize="39" color="#915e15" align="center" vAlign="middle" autoSize="shrink" text="100" input="true" maxLength="3" restrict="[0-9]"/>
+    <text id="n21_l6ko" name="txtSelNum" xy="57,200" size="60,53" font="ui://eg2y0ldpa0cftkx" fontSize="39" color="#915e15" align="center" vAlign="middle" autoSize="shrink" text="100" input="true" maxLength="3"/>
     <component id="n15_cu9w" name="btnReduce" src="cu9wtmf" fileName="components/BtnReduce.xml" xy="0,202"/>
     <component id="n16_cu9w" name="btnAdd" src="cu9wtmg" fileName="components/BtnAdd.xml" xy="122,203"/>
     <image id="n0_v5no" name="n0" src="m5qxtmy" fileName="images/wpk_db.png" xy="0,1" group="n20_yjmk"/>

+ 5 - 4
GameClient/Assets/Game/HotUpdate/Views/Bag/GiftBoxSelectorView.cs

@@ -246,9 +246,9 @@ namespace GFGGame
             if (listItem.m_txtSelNum.text == "0")
             {
                 // 将文本设置为空字符串
-                listItem.m_txtSelNum.text = "";
-                // 延迟 0.1 秒后恢复文本
-                Timers.inst.Add(0.1f, 1, (obj) => { listItem.m_txtSelNum.text = ""; });
+                listItem.m_txtSelNum.text = " ";
+                // 延迟 0.2 秒后恢复文本
+                Timers.inst.Add(0.2f, 1, (obj) => { listItem.m_txtSelNum.text = " "; });
             }
         }
 
@@ -309,7 +309,8 @@ namespace GFGGame
 
         private void UpdateSelNumSel(UI_ListSelectorItem listItem, ItemCfg itemCfg)
         {
-            if (string.IsNullOrEmpty(listItem.m_txtSelNum.text))
+            bool isNumeric = int.TryParse(listItem.m_txtSelNum.text, out var result);
+            if (!isNumeric)
             {
                 listItem.m_txtSelNum.text = "0";
             }

BIN
GameClient/Assets/ResIn/UI/Bag/Bag_fui.bytes