hch
11 小时以前 bd41d84bbd61de37bd880c591ecce690ebe294bd
Main/Utility/UIHelper.cs
@@ -325,6 +325,13 @@
        return false;
    }
    // 检查字符串是不是纯整数
    public static bool IsNumeric(string input)
    {
        return int.TryParse(input, out _);
    }
    public static string GetColorNameByItemColor(int itemColor)
    {
        switch (itemColor)
@@ -1256,13 +1263,15 @@
        return content;
    }
    //检查名字长度,玩家名和公会名
    //不同国家长度不同,排版不同
    public static bool SatisfyNameLength(string name, out int error)
    {
        error = 0;
        //bool pureChinese = Regex.IsMatch(name, "^[\u4e00-\u9fa5]+$");
        //var chsCount = GetChsCount(name);
        int length = Encoding.Default.GetBytes(name).Length;
        var maxlength = 20;
        var maxlength = 14;  //纯中文不建议超过7个字
        var minlength = 3;
        if (length > maxlength)
        {
@@ -1362,9 +1371,24 @@
    public static string RemoveColor(string content)
    {
    {
        content = WordAnalysis.Color_Start_Regex.Replace(content, string.Empty);
        content = WordAnalysis.Color_End_Regex.Replace(content, string.Empty);
        return content;
    }
    //复制到剪贴板
    // TODO 暂不支持web后续补充
    public static void CopyToClipboard(string text)
    {
        GUIUtility.systemCopyBuffer = text;
        Debug.Log("文字已复制到剪贴板: " + text);
    }
    //获取剪切板内容
    public static string GetClipboardText()
    {
        return GUIUtility.systemCopyBuffer;
    }
}