| | |
| | | return false; |
| | | } |
| | | |
| | | // 检查字符串是不是纯整数 |
| | | public static bool IsNumeric(string input) |
| | | { |
| | | return int.TryParse(input, out _); |
| | | } |
| | | |
| | | |
| | | public static string GetColorNameByItemColor(int itemColor) |
| | | { |
| | | switch (itemColor) |
| | |
| | | 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) |
| | | { |
| | |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | } |