From 6ce8b9e22fc13be34b442c7b6af48b42cd44275a Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:00:58 +0800 Subject: +init --- TMPro/TMP_DigitValidator.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 TMPro/TMP_DigitValidator.cs (limited to 'TMPro/TMP_DigitValidator.cs') diff --git a/TMPro/TMP_DigitValidator.cs b/TMPro/TMP_DigitValidator.cs new file mode 100644 index 0000000..80e3a77 --- /dev/null +++ b/TMPro/TMP_DigitValidator.cs @@ -0,0 +1,17 @@ +using System; + +namespace TMPro; + +[Serializable] +public class TMP_DigitValidator : TMP_InputValidator +{ + public override char Validate(ref string text, ref int pos, char ch) + { + if (ch >= '0' && ch <= '9') + { + pos++; + return ch; + } + return '\0'; + } +} -- cgit v1.1-26-g67d0