添加了标识更新
但是只有界面没有功能
This commit is contained in:
26
BITKit/Scripts/Text/RegularExpressionResource.cs
Normal file
26
BITKit/Scripts/Text/RegularExpressionResource.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text.RegularExpressions;
|
||||
using BITKit;
|
||||
|
||||
namespace BITKit;
|
||||
[GlobalClass]
|
||||
public partial class RegularExpressionResource : TextValidationResource
|
||||
{
|
||||
[Export] private string regex;
|
||||
[Export] private string errorReason;
|
||||
|
||||
public override bool IsTextValid(string text, out string _errorReason)
|
||||
{
|
||||
switch (Regex.IsMatch(text, regex))
|
||||
{
|
||||
case true:
|
||||
_errorReason = string.Empty;
|
||||
return true;
|
||||
case false:
|
||||
_errorReason = errorReason;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user