Files
XericUIActionVessel/Runtime/InterfaceAttributeReflectionGenerator/Scripts/Attribute/XuiavrgStringCheckAttribute.cs
T
lrss3 5f93152c9b 添加了更多的反射检查逻辑。
修复布局组件的缓存引用关系
2026-04-28 17:13:23 +08:00

48 lines
1.6 KiB
C#

using System;
using UnityEngine;
namespace XericUI.ReflectionUIGenerator
{
/// <summary>
/// 字符串检查
/// </summary>
public class XuiavrgStringCheckAttribute : Attribute, IXuiavrgAttribute
{
public readonly int minLength;
public readonly int maxLength;
public readonly string regexPattern;
public readonly bool onlyLetters;
public readonly bool onlyNumber;
public readonly bool onlyEmail;
public readonly bool onlyPhone;
public readonly bool onlyUrl;
public XuiavrgStringCheckAttribute(
int minLength = 0, int maxLength = int.MaxValue,
string regexPattern = "",
bool onlyLetters = false, bool onlyNumber = false, bool onlyEmail = true, bool onlyPhone = true,
bool onlyUrl = true)
{
this.minLength = minLength;
this.maxLength = maxLength;
this.regexPattern = regexPattern;
this.onlyLetters = onlyLetters;
this.onlyNumber = onlyNumber;
this.onlyEmail = onlyEmail;
this.onlyPhone = onlyPhone;
this.onlyUrl = onlyUrl;
}
public void BindProperty(XuiavrgInspectorProperty property)
{
property.stringMinLength = minLength;
property.stringMaxLength = maxLength;
property.stringRegexPattern = regexPattern;
property.stringOnlyLetters = onlyLetters;
property.stringOnlyNumber = onlyNumber;
property.stringOnlyEmail = onlyEmail;
property.stringOnlyPhone = onlyPhone;
property.stringOnlyUrl = onlyUrl;
}
}
}