yyl
2025-10-21 3bd7f56906e31e8fe0072108c9d4652707b51de8
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)
@@ -969,7 +976,7 @@
        {3, PlayerDataType.Silver},
        {41, PlayerDataType.default26},
        {42, PlayerDataType.default33},
        {53, PlayerDataType.ChallengeVoucher},
    };
    public static long GetMoneyCnt(int moneyType)
@@ -1110,6 +1117,11 @@
                {
                    //淘金令
                    return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.GoldRush);
                }
            case 53:
                {
                    //挑战凭证
                    return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ChallengeVoucher);
                }
            case 98:
                {
@@ -1256,13 +1268,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 +1376,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;
    }
}