| using System;  | 
| using System.Text;  | 
| using UnityEngine;  | 
| using System.Linq;  | 
| using System.Xml.Linq;  | 
| using System.Collections;  | 
| using System.Collections.Generic;  | 
| using UnityEngine.UI;  | 
|   | 
| using System.Text.RegularExpressions;  | 
| using System.IO;  | 
| using vnxbqy.UI;  | 
| using LitJson;  | 
|   | 
| /// <summary>  | 
| /// UI辅助类  | 
| /// </summary>  | 
|   | 
| public static class UIHelper  | 
| {  | 
|   | 
|     public static readonly string no_breaking_space = "\u00A0"; //Text文本框输入空格自动换行问题 替换编码  | 
|   | 
|     #region UI通用  | 
|     public static void SetIconWithMoneyType(this Image _image, int moneyType)  | 
|     {  | 
|         if (_image == null) return;  | 
|         string iconKey = StringUtility.Contact("Money_Type_", moneyType);  | 
|         _image.SetSprite(iconKey);  | 
|     }  | 
|   | 
|     public static void SetSmallIconWithMoneyType(this Image _image, int moneyType)  | 
|     {  | 
|         if (_image == null) return;  | 
|         string iconKey = StringUtility.Contact("SmallMoney", moneyType);  | 
|         _image.SetSprite(iconKey);  | 
|     }  | 
|   | 
|     /// <summary>  | 
|     /// 分离字符串插入空格  | 
|     /// </summary>  | 
|     public static string GetSuitNameByName(string attrName)  | 
|     {  | 
|         string suitStr = "";  | 
|         for (int i = 0; i < attrName.Length; i++)  | 
|         {  | 
|             if (i != attrName.Length - 1)  | 
|             {  | 
|                 if (attrName.Length == 2)  | 
|                 {  | 
|                     suitStr = StringUtility.Contact(suitStr, attrName[i], "        ");  | 
|                 }  | 
|                 else if (attrName.Length == 3)  | 
|                 {  | 
|                     suitStr = StringUtility.Contact(suitStr, attrName[i], "  ");  | 
|                 }  | 
|                 else  | 
|                 {  | 
|                     suitStr = StringUtility.Contact(suitStr, attrName[i]);  | 
|                 }  | 
|             }  | 
|             else  | 
|             {  | 
|                 suitStr = StringUtility.Contact(suitStr, attrName[i]);  | 
|             }  | 
|         }  | 
|         return suitStr;  | 
|   | 
|     }  | 
|   | 
|     // 基于itemColor 下,ColorEx做二级区分  | 
|     public static void SetItemBackGround(this Image _image, int itemColor, int ColorEx = 0)  | 
|     {  | 
|         if (_image == null)  | 
|         {  | 
|             return;  | 
|         }  | 
|         _image.SetSprite(string.Format("Common_Public_ItemColor{0}{1}", itemColor, ColorEx));  | 
|     }  | 
|     /// <summary>  | 
|     /// 剩余时间  | 
|     /// </summary>  | 
|     /// <param name="startTime">格式 年-月-日 小时:分钟:秒</param>  | 
|     /// <param name="ownTime">毫秒</param>  | 
|     /// <returns></returns>  | 
|     private static Regex TimeRegex = new Regex(@"([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+)", RegexOptions.Singleline);  | 
|     public static int GetSurplusSeconds(string startTime, int seconds)  | 
|     {  | 
|         string start = GetTime(startTime);  | 
|         if (start.Equals(string.Empty))  | 
|         {  | 
|             return 0;  | 
|         }  | 
|         DateTime s = Convert.ToDateTime(start);  | 
|         DateTime t = s.AddTicks(seconds * TimeSpan.TicksPerSecond);  | 
|         DateTime n = TimeUtility.ServerNow;  | 
|         TimeSpan span = t - n;  | 
|         return Mathf.Max(0, (int)span.TotalSeconds);  | 
|     }  | 
|   | 
|     public static string GetTime(string startTime)  | 
|     {  | 
|         if (!TimeRegex.IsMatch(startTime))  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         Match match = TimeRegex.Match(startTime);  | 
|         int year = int.Parse(match.Groups[1].Value);  | 
|         int month = int.Parse(match.Groups[2].Value);  | 
|         int day = int.Parse(match.Groups[3].Value);  | 
|         int h = int.Parse(match.Groups[4].Value);  | 
|         int mi = int.Parse(match.Groups[5].Value);  | 
|         int sc = int.Parse(match.Groups[6].Value);  | 
|   | 
|         return string.Format("{0}-{1}-{2} {3}:{4}:{5}", year, month, day, h, mi, sc);  | 
|   | 
|     }  | 
|     /// <summary>  | 
|     /// 获取消逝的时间  | 
|     /// </summary>  | 
|     /// <param name="lastTime"></param>  | 
|     /// <returns></returns>  | 
|     public static string GetFadeTime(uint lastTime)  | 
|     {  | 
|         DateTime n = TimeUtility.ServerNow;  | 
|         TimeSpan span = n - TimeUtility.GetTime(lastTime);  | 
|         if (span.TotalDays > 1) return Math.Floor(span.TotalDays) + Language.Get("L1074");  | 
|         else if (span.TotalHours > 1) return Math.Floor(span.TotalHours) + Language.Get("L1072");  | 
|         else if (span.TotalMinutes > 1) return Math.Floor(span.TotalMinutes) + Language.Get("L1073");  | 
|         else return 1 + Language.Get("L1073");  | 
|     }  | 
|     /// <summary>  | 
|     /// 根据属性获取玩家数据  | 
|     /// </summary>  | 
|     /// <param name="type"></param>  | 
|     /// <returns></returns>  | 
|     public static ulong GetPropertyValue(PropertyType type)  | 
|     {  | 
|         switch (type)  | 
|         {  | 
|             case PropertyType.LV:  | 
|                 return PlayerDatas.Instance.baseData.LV;  | 
|             case PropertyType.POWER:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.STR;  | 
|             case PropertyType.AGILITY:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.PHY;  | 
|             case PropertyType.PHYSIQUE:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.CON;  | 
|             case PropertyType.MENTALITY:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.PNE;  | 
|             case PropertyType.HP:  | 
|                 return PlayerDatas.Instance.extersion.MaxHP;  | 
|             case PropertyType.ATK:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.MAXATK;  | 
|             case PropertyType.DEF:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.DEF;  | 
|             case PropertyType.HIT:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.HIT;  | 
|             case PropertyType.MISS:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.Miss;  | 
|             case PropertyType.ATKSPEED:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.battleValEx1;  | 
|             case PropertyType.CritChance:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.SuperHitRate;  | 
|             case PropertyType.CritHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.SuperHit;  | 
|             case PropertyType.CritResis:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.SuperHitReduce;  | 
|             case PropertyType.HeartHit:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.luckHitRate;  | 
|             case PropertyType.HeartHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.luckHitVal;  | 
|             case PropertyType.HeartResis:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.LuckyHitRateReduce;  | 
|             case PropertyType.SkillHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.SkillAtkRate;  | 
|             case PropertyType.PVPAddHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.DamagePVP;  | 
|             case PropertyType.PVPReduceHurt:  | 
|                 return PlayerDatas.Instance.GetPlayerDataByType((PlayerDataType)191);  | 
|             case PropertyType.LifeReply:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.HPRestorePer;  | 
|             case PropertyType.HurtReflect:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.DamageBackRate;  | 
|             case PropertyType.MoveSpeed:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.SpeedValue;  | 
|             case PropertyType.PetAddHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.PetDamPer;  | 
|             case PropertyType.RealHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.realATK;  | 
|             case PropertyType.RealResis:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.realDEF;  | 
|             case PropertyType.DefyDef:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.IgnoreDefRate;  | 
|             case PropertyType.DefyDefResis:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.IgnoreDefRateReduce;  | 
|             case PropertyType.DefChance:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.DamChanceDef;  | 
|             case PropertyType.BloodHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.BleedDamage;  | 
|             case PropertyType.AktReplyBlood:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.BattleValEx2;  | 
|             case PropertyType.Stun:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.FaintRate;  | 
|             case PropertyType.CtrlResis:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.FaintDefRate;  | 
|             case PropertyType.AddFinalHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.FinalHurt;  | 
|             case PropertyType.ReduceFinalHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.FinalHurtReduce;  | 
|             case PropertyType.PVPAddHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.DamagePerPVP;  | 
|             case PropertyType.PVPReduceHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.DamagePerPVPReduce;  | 
|             case PropertyType.DleHitChance:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.ComboDamPerRate;  | 
|             case PropertyType.DleHurt:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.ComboDamPer;  | 
|             case PropertyType.ReduceSkillHurtPercent:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.skillAtkRateReduce;  | 
|             case PropertyType.NpcHurtAddPer:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.NpcHurtAddPer;  | 
|             case PropertyType.Luck:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.luckValue;  | 
|             case PropertyType.Mater:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.mater;  | 
|             case PropertyType.Wood:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.wood;  | 
|             case PropertyType.Water:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.water;  | 
|             case PropertyType.Fire:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.fire;  | 
|             case PropertyType.Earth:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.earth;  | 
|             case PropertyType.ReduceCrit:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.reduceCrit;  | 
|             case PropertyType.ReduceHeartHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.reduceHeartHurt;  | 
|             case PropertyType.ReduceFinalHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.reduceFinalHurt;  | 
|             case PropertyType.AtkPercent:  | 
|             case PropertyType.CritHurtPercent:  | 
|             case PropertyType.DodgePercent:  | 
|                 return (ulong)ModelCenter.Instance.GetModel<ReikiRootModel>().GetReikiPropertyValue((int)type);  | 
|   | 
|             case PropertyType.SkillAddPerA:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerA;  | 
|             case PropertyType.SkillAddPerB:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerB;  | 
|             case PropertyType.SkillAddPerC:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerC;  | 
|             case PropertyType.SkillAddPerD:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerD;  | 
|             case PropertyType.SkillAddPerE:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerE;  | 
|             case PropertyType.SkillAddPerF:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerF;  | 
|             case PropertyType.SkillAddPerG:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillAddPerG;  | 
|             case PropertyType.SkillReducePerA:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerA;  | 
|             case PropertyType.SkillReducePerB:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerB;  | 
|             case PropertyType.SkillReducePerC:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerC;  | 
|             case PropertyType.SkillReducePerD:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerD;  | 
|             case PropertyType.SkillReducePerE:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerE;  | 
|             case PropertyType.SkillReducePerF:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerF;  | 
|             case PropertyType.SkillReducePerG:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.skillReducePerG;  | 
|             case PropertyType.ReduceSkillCDPer:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.battleValEx3;  | 
|             case PropertyType.AddFinalHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.extersion.FunalHurtPer;  | 
|             case PropertyType.AddNormalHurt:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.NormalHurt;  | 
|             case PropertyType.AddNormalHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.NormalHurtPer;  | 
|             case PropertyType.AddSkillHurt:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.FabaoHurt;  | 
|             case PropertyType.AddSkillHurtPer:  | 
|                 return (ulong)PlayerDatas.Instance.baseData.FabaoHurtPer;  | 
|             case PropertyType.AddPVEHurt:  | 
|                 return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.DamagePVE);  | 
|         }  | 
|         return 0;  | 
|     }  | 
|   | 
|   | 
|     /// <summary>  | 
|     /// 换行  | 
|     /// </summary>  | 
|     /// <param name="val"></param>  | 
|     /// <returns></returns>  | 
|     private static Regex NewLineRegex = new Regex(@"</r>", RegexOptions.Singleline);  | 
|     public static string ReplaceNewLine(string val)  | 
|     {  | 
|         return val.Replace(@"</r>", "\n");  | 
|     }  | 
|   | 
|     public static double numto2Decimals(double value)  | 
|     {  | 
|         //为什么要value * 1000/10 这么写,特殊的数字会有问题,比如36.80000,会(int)(value * 100)被计算为3679  | 
|         //测试下只有30几点8000的才会这样  | 
|         return (int)(value * 1000 / 10) / 100.00;  | 
|     }  | 
|   | 
|     /// <summary>  | 
|     /// 大数值转化 最多两个小数 不四舍五入  | 
|     /// </summary>  | 
|     private static StringBuilder _textBuilder = new StringBuilder();  | 
|     public static string ReplaceLargeNum(double num)  | 
|     {  | 
|         _textBuilder.Length = 0;  | 
|         double hm = numto2Decimals(num / 100000000.0);  | 
|         if (hm >= 100)  | 
|         {  | 
|             _textBuilder.Append((int)hm);  | 
|             _textBuilder.Append(Language.Get("L1070"));  | 
|             return _textBuilder.ToString();  | 
|         }  | 
|         else if (hm >= 10)  | 
|         {  | 
|             _textBuilder.Append(hm.ToString("0.##"));  | 
|             _textBuilder.Append(Language.Get("L1070"));  | 
|             return _textBuilder.ToString();  | 
|         }  | 
|         if (hm >= 1)  | 
|         {  | 
|             _textBuilder.Append(hm.ToString("0.##"));  | 
|             _textBuilder.Append(Language.Get("L1070"));  | 
|             return _textBuilder.ToString();  | 
|         }  | 
|   | 
|         double tt = numto2Decimals(num / 10000.0);  | 
|         if (tt >= 100)  | 
|         {  | 
|             _textBuilder.Append((int)tt);  | 
|             _textBuilder.Append(Language.Get("L1071"));  | 
|             return _textBuilder.ToString();  | 
|         }  | 
|         else if (tt >= 10)  | 
|         {  | 
|             _textBuilder.Append(tt.ToString("0.##"));  | 
|             _textBuilder.Append(Language.Get("L1071"));  | 
|             return _textBuilder.ToString();  | 
|         }  | 
|         else if (tt >= 1 && num >= 10000)  | 
|         {  | 
|             _textBuilder.Append(tt.ToString("0.##"));  | 
|             _textBuilder.Append(Language.Get("L1071"));  | 
|             return _textBuilder.ToString();  | 
|         }  | 
|   | 
|         if (_textBuilder.Length == 0)  | 
|         {  | 
|             _textBuilder.Append(num.ToString("0.##"));  | 
|         }  | 
|         return _textBuilder.ToString();  | 
|     }  | 
|   | 
|     #region round的代码注释  | 
|     //public static string ReplaceLargeNum(double num)  | 
|     //{  | 
|     //    _textBuilder.Length = 0;  | 
|     //    float hm = (float)Math.Round(num / 100000000, 2);  | 
|     //    if (hm >= 100)  | 
|     //    {  | 
|     //        hm = (int)Math.Round(num / 100000000);  | 
|     //        _textBuilder.Append(hm);  | 
|     //        _textBuilder.Append(Language.Get("L1070"));  | 
|     //        return _textBuilder.ToString();  | 
|     //    }  | 
|     //    else if (hm >= 10)  | 
|     //    {  | 
|     //        hm = (float)Math.Round(num / 100000000, 1);  | 
|     //        _textBuilder.Append(hm);  | 
|     //        _textBuilder.Append(Language.Get("L1070"));  | 
|     //        return _textBuilder.ToString();  | 
|     //    }  | 
|     //    if (hm >= 1)  | 
|     //    {  | 
|     //        _textBuilder.Append(hm);  | 
|     //        _textBuilder.Append(Language.Get("L1070"));  | 
|     //        return _textBuilder.ToString();  | 
|     //    }  | 
|   | 
|     //    float tt = (float)Math.Round(num / 10000, 2);  | 
|     //    if (tt >= 100)  | 
|     //    {  | 
|     //        tt = (float)Math.Round(num / 10000);  | 
|     //        _textBuilder.Append(tt);  | 
|     //        _textBuilder.Append(Language.Get("L1071"));  | 
|     //        return _textBuilder.ToString();  | 
|     //    }  | 
|     //    else if (tt >= 10)  | 
|     //    {  | 
|     //        tt = (float)Math.Round(num / 10000, 1);  | 
|     //        _textBuilder.Append(tt);  | 
|     //        _textBuilder.Append(Language.Get("L1071"));  | 
|     //        return _textBuilder.ToString();  | 
|     //    }  | 
|     //    else if (tt >= 1 && num >= 10000)  | 
|     //    {  | 
|     //        _textBuilder.Append(tt);  | 
|     //        _textBuilder.Append(Language.Get("L1071"));  | 
|     //        return _textBuilder.ToString();  | 
|     //    }  | 
|   | 
|     //    if (_textBuilder.Length == 0)  | 
|     //    {  | 
|     //        tt = (float)Math.Round(num, 2);  | 
|     //        _textBuilder.Append(tt);  | 
|     //    }  | 
|     //    return _textBuilder.ToString();  | 
|     //}  | 
|     #endregion  | 
|   | 
|     public static string ReplaceXianYuanCoinsNum(double num)  | 
|     {  | 
|         StringBuilder sb = new StringBuilder();  | 
|         float hm = (float)Math.Round(num / 100000000, 2);  | 
|         if (hm >= 100)  | 
|         {  | 
|             hm = (int)Math.Round(num / 100000000);  | 
|             sb.Append(hm);  | 
|             sb.Append(Language.Get("L1070"));  | 
|             return sb.ToString();  | 
|         }  | 
|         else if (hm >= 10)  | 
|         {  | 
|             hm = (float)Math.Round(num / 100000000, 1);  | 
|             sb.Append(hm);  | 
|             sb.Append(Language.Get("L1070"));  | 
|             return sb.ToString();  | 
|         }  | 
|         else if (hm >= 1)  | 
|         {  | 
|             sb.Append(hm);  | 
|             sb.Append(Language.Get("L1070"));  | 
|             return sb.ToString();  | 
|         }  | 
|   | 
|         float tt = (float)Math.Round(num / 10000, 2);  | 
|         if (tt >= 100)  | 
|         {  | 
|             tt = (float)Math.Round(num / 10000);  | 
|             sb.Append(tt);  | 
|             sb.Append(Language.Get("L1071"));  | 
|             return sb.ToString();  | 
|         }  | 
|   | 
|         if (sb.Length == 0)  | 
|         {  | 
|             tt = (float)Math.Round(num, 2);  | 
|             sb.Append(tt);  | 
|         }  | 
|         return sb.ToString();  | 
|     }  | 
|   | 
|     public static float ReplacePercentage(float num, int isPer, int decimals = 1)  | 
|     {  | 
|         if (isPer == 1 || isPer == 2)  | 
|         {  | 
|             return (float)Math.Round(num / 100, decimals);  | 
|         }  | 
|         else  | 
|         {  | 
|             return (int)num;  | 
|         }  | 
|     }  | 
|   | 
|     static Regex s_SpecialCharacterRegex = new Regex("[()()@!#$%^&*[]|_]");  | 
|     static Regex s_AsciiCharacterRegex = new Regex("[\x00-\x1F]|[\x21-\x2F]|[\x3A-\x40]|[\x5B-\x60]|[\x7B-\x7E]");  | 
|     public static bool HasSpecialCharac(string str)  | 
|     {  | 
|         if (s_SpecialCharacterRegex.IsMatch(str))  | 
|         {  | 
|             return true;  | 
|         }  | 
|         if (s_AsciiCharacterRegex.IsMatch(str))  | 
|         {  | 
|             return true;  | 
|         }  | 
|         return false;  | 
|     }  | 
|   | 
|     public static string GetColorNameByItemColor(int itemColor)  | 
|     {  | 
|         switch (itemColor)  | 
|         {  | 
|             case 1:  | 
|                 return Language.Get("Market_Text_42");  | 
|             case 2:  | 
|                 return Language.Get("Market_Text_43");  | 
|             case 3:  | 
|                 return Language.Get("Market_Text_44");  | 
|             case 4:  | 
|                 return Language.Get("Market_Text_45");  | 
|             case 5:  | 
|                 return Language.Get("Market_Text_46");  | 
|             case 6:  | 
|             case 7:  | 
|             case 8:  | 
|                 return Language.Get("Market_Text_47");  | 
|             case 9:  | 
|                 return Language.Get("Market_Text_471");  | 
|         }  | 
|         return "";  | 
|     }  | 
|   | 
|     #endregion  | 
|   | 
|     #region 文字色值  | 
|     public static readonly Color s_BrightPinkColor = new Color32(246, 64, 141, 255);  | 
|     public static readonly Color s_BrightRedColor = new Color32(255, 3, 3, 255);  | 
|     public static readonly Color s_BrightPurpleColor = new Color32(218, 72, 213, 255);  | 
|     public static readonly Color s_BrightBlueColor = new Color32(0, 107, 227, 255); //006BE3FF  | 
|     public static readonly Color s_BrightOrangeColor = new Color32(255, 103, 1, 255); //FF6701FF  | 
|     public static readonly Color s_BrightWhiteColor = new Color32(104, 104, 104, 255); //686868  | 
|     public static readonly Color s_BrightGreenColor = new Color32(16, 157, 6, 255); //109d06  | 
|   | 
|     public static readonly Color s_DarkPinkColor = new Color32(255, 124, 124, 255);  | 
|     public static readonly Color s_DarkRedColor = new Color32(250, 1, 1, 255);  | 
|     public static readonly Color s_DarkPurpleColor = new Color32(236, 75, 246, 255);  | 
|     public static readonly Color s_DarkBlueColor = new Color32(49, 206, 251, 255);//31cefb  | 
|     public static readonly Color s_DarkOrangeColor = new Color32(248, 152, 59, 255);  | 
|     public static readonly Color s_DarkWhiteColor = new Color32(247, 247, 247, 255);  | 
|     public static readonly Color s_DarkGreenColor = new Color32(53, 225, 34, 255); //35e122  | 
|   | 
|     public static readonly Color s_NavyBrown = new Color32(64, 28, 6, 255);//401c06  | 
|     public static readonly Color s_Black = new Color32(0, 0, 0, 255);  | 
|     public static readonly Color s_NavyYellow = new Color32(255, 239, 71, 255);  | 
|     public static readonly Color s_LightGreen = new Color32(141, 220, 17, 255);//8ddc11  | 
|     public static readonly Color s_LightYellow = new Color32(255, 244, 205, 255); //fff4cd  | 
|     public static readonly Color s_Gray = new Color32(204, 204, 204, 255);  | 
|     public static readonly Color s_Gold = new Color32(255, 239, 71, 255);//ffef47  | 
|     public static readonly Color s_EarthYellow = new Color32(248, 152, 59, 255);//f8983b  | 
|   | 
|     public static readonly Color s_BrightDanLV0 = new Color32(102, 102, 102, 255); //666666  | 
|     public static readonly Color s_BrightDanLV1 = new Color32(148, 96, 255, 255); //9460ff  | 
|     public static readonly Color s_BrightDanLV2 = new Color32(0, 102, 255, 255); //0066ff  | 
|     public static readonly Color s_BrightDanLV3 = new Color32(0, 179, 55, 255); //00b337  | 
|     public static readonly Color s_BrightDanLV4 = new Color32(255, 102, 0, 255); //ff6600  | 
|     public static readonly Color s_BrightDanLV5 = new Color32(255, 0, 0, 255); //ff0000  | 
|     public static readonly Color s_BrightDanLV6 = new Color32(255, 0, 246, 255); //ff00f6  | 
|   | 
|     public static readonly Color s_GrayDanLV0 = new Color32(221, 221, 221, 255); //dddddd  | 
|     public static readonly Color s_GrayDanLV1 = new Color32(121, 153, 255, 255); //7999ff  | 
|     public static readonly Color s_GrayDanLV2 = new Color32(0, 198, 255, 255); //00c6ff  | 
|     public static readonly Color s_GrayDanLV3 = new Color32(102, 255, 0, 255); //66ff00  | 
|     public static readonly Color s_GrayDanLV4 = new Color32(255, 144, 0, 255); //ff9000  | 
|     public static readonly Color s_GrayDanLV5 = new Color32(255, 0, 0, 255); //ff0000  | 
|     public static readonly Color s_GrayDanLV6 = new Color32(240, 0, 255, 255); //f000ff  | 
|   | 
|     public static Color GetDanLVColor(int danLv, bool bright = false)  | 
|     {  | 
|         var crossDanLVConfig = CrossServerArenaConfig.Get(danLv);  | 
|         if (crossDanLVConfig != null)  | 
|         {  | 
|             switch (crossDanLVConfig.DanType)  | 
|             {  | 
|                 case 0:  | 
|                     return bright ? s_BrightDanLV0 : s_GrayDanLV0;  | 
|                 case 1:  | 
|                     return bright ? s_BrightDanLV1 : s_GrayDanLV1;  | 
|                 case 2:  | 
|                     return bright ? s_BrightDanLV2 : s_GrayDanLV2;  | 
|                 case 3:  | 
|                     return bright ? s_BrightDanLV3 : s_GrayDanLV3;  | 
|                 case 4:  | 
|                     return bright ? s_BrightDanLV4 : s_GrayDanLV4;  | 
|                 case 5:  | 
|                     return bright ? s_BrightDanLV5 : s_GrayDanLV5;  | 
|                 case 6:  | 
|                     return bright ? s_BrightDanLV6 : s_GrayDanLV6;  | 
|             }  | 
|         }  | 
|         return Color.white;  | 
|     }  | 
|   | 
|     public static string AppendDanLVNameColor(int danLv, bool bright = false)  | 
|     {  | 
|         var crossDanLVConfig = CrossServerArenaConfig.Get(danLv);  | 
|         if (crossDanLVConfig == null)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         var name = crossDanLVConfig.Name;  | 
|         switch (crossDanLVConfig.DanType)  | 
|         {  | 
|             case 0:  | 
|                 return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", name, "</color>");  | 
|             case 1:  | 
|                 return StringUtility.Contact("<color=#", bright ? "9460ff" : "7999ff", ">", name, "</color>");  | 
|             case 2:  | 
|                 return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", name, "</color>");  | 
|             case 3:  | 
|                 return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", name, "</color>");  | 
|             case 4:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", name, "</color>");  | 
|             case 5:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", name, "</color>");  | 
|             case 6:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", name, "</color>");  | 
|         }  | 
|         return name;  | 
|     }  | 
|   | 
|     public static Color GetUIColor(int itemColor, bool bright = false)  | 
|     {  | 
|         switch (itemColor)  | 
|         {  | 
|             case 0:  | 
|                 return GetUIColor(TextColType.White, bright);  | 
|             case 1:  | 
|                 return GetUIColor(TextColType.White, bright);  | 
|             case 2:  | 
|                 return GetUIColor(TextColType.Blue, bright);  | 
|             case 3:  | 
|                 return GetUIColor(TextColType.Purple, bright);  | 
|             case 4:  | 
|                 return GetUIColor(TextColType.Orange, bright);  | 
|             case 5:  | 
|                 return GetUIColor(TextColType.Red, bright);  | 
|             case 6:  | 
|             case 7:  | 
|             case 8:  | 
|                 return GetUIColor(TextColType.Pink, bright);  | 
|             case 9:  | 
|                 return GetUIColor(TextColType.Green, bright);  | 
|         }  | 
|         return GetUIColor(TextColType.White, bright);  | 
|     }  | 
|   | 
|     public static Color GetUIColor(TextColType type, bool bright = false)  | 
|     {  | 
|         switch (type)  | 
|         {  | 
|             case TextColType.None:  | 
|             case TextColType.White:  | 
|                 return bright ? s_BrightWhiteColor : s_DarkWhiteColor;  | 
|             case TextColType.Blue:  | 
|                 return bright ? s_BrightBlueColor : s_DarkBlueColor;  | 
|             case TextColType.Purple:  | 
|                 return bright ? s_BrightPurpleColor : s_DarkPurpleColor;  | 
|             case TextColType.Orange:  | 
|                 return bright ? s_BrightOrangeColor : s_DarkOrangeColor;  | 
|             case TextColType.Red:  | 
|                 return bright ? s_BrightRedColor : s_DarkRedColor;  | 
|             case TextColType.Pink:  | 
|                 return bright ? s_BrightPinkColor : s_DarkPinkColor;  | 
|             case TextColType.Green:  | 
|                 return bright ? s_BrightGreenColor : s_DarkGreenColor;  | 
|             case TextColType.NavyBrown:  | 
|                 return s_NavyBrown;  | 
|             case TextColType.DarkGreen:  | 
|                 return s_BrightGreenColor;  | 
|             case TextColType.Black:  | 
|                 return s_Black;  | 
|             case TextColType.NavyYellow:  | 
|                 return s_NavyYellow;  | 
|             case TextColType.LightGreen:  | 
|                 return s_LightGreen;  | 
|             case TextColType.LightYellow:  | 
|                 return s_LightYellow;  | 
|             case TextColType.Gray:  | 
|                 return s_Gray;  | 
|         }  | 
|         return bright ? s_BrightWhiteColor : s_DarkWhiteColor;  | 
|     }  | 
|   | 
|     private static Regex m_TextColorRegex = new Regex("<color=#[0-9a-zA-Z]+>(.*)</color>", RegexOptions.Singleline);  | 
|   | 
|     public static string AppendColor(TextColType type, string msg, bool bright = false)  | 
|     {  | 
|         if (m_TextColorRegex.IsMatch(msg) && msg.ToLower().StartsWith("<color=#")  | 
|             && msg.ToLower().EndsWith("</color>"))  | 
|         {  | 
|             Match match = m_TextColorRegex.Match(msg);  | 
|             msg = match.Groups[1].Value;  | 
|         }  | 
|         switch (type)  | 
|         {  | 
|             case TextColType.None:  | 
|             case TextColType.White:  | 
|                 return StringUtility.Contact("<color=#", bright ? "686868" : "f7f7f7", ">", msg, "</color>");  | 
|             case TextColType.Blue:  | 
|                 return StringUtility.Contact("<color=#", bright ? "006be3" : "31cefb", ">", msg, "</color>");  | 
|             case TextColType.Purple:  | 
|                 return StringUtility.Contact("<color=#", bright ? "da48d5" : "ec4bf6", ">", msg, "</color>");  | 
|             case TextColType.Orange:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff6701" : "f8983b", ">", msg, "</color>");  | 
|             case TextColType.Red:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff0303" : "ff0101", ">", msg, "</color>");  | 
|             case TextColType.Pink:  | 
|                 return StringUtility.Contact("<color=#", bright ? "f6408d" : "ff7c7c", ">", msg, "</color>");  | 
|             case TextColType.Green:  | 
|                 return StringUtility.Contact("<color=#", bright ? "109d06" : "35e122", ">", msg, "</color>");  | 
|             case TextColType.NavyBrown:  | 
|                 return StringUtility.Contact("<color=#", "401c06", ">", msg, "</color>");  | 
|             case TextColType.DarkGreen:  | 
|                 return StringUtility.Contact("<color=#", "109d06", ">", msg, "</color>");  | 
|             case TextColType.Black:  | 
|                 return StringUtility.Contact("<color=#", "000000", ">", msg, "</color>");  | 
|             case TextColType.LightYellow:  | 
|                 return StringUtility.Contact("<color=#", "fff4cd", ">", msg, "</color>");  | 
|             case TextColType.LightGreen:  | 
|                 return StringUtility.Contact("<color=#", "8ddc11", ">", msg, "</color>");  | 
|             case TextColType.Gray:  | 
|                 return StringUtility.Contact("<color=#", "686868", ">", msg, "</color>");  | 
|         }  | 
|         return msg;  | 
|     }  | 
|   | 
|     //needName 指境界0是否需要名称  | 
|     public static string GetRealmName(int realmLv, bool bright = false, bool needName = false)  | 
|     {  | 
|         if (realmLv <= 0 && !needName)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         var config = RealmConfig.Get(realmLv);  | 
|         if (config == null)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         return GetRealmColorByLv(realmLv, config.Name, bright);  | 
|     }  | 
|   | 
|     //strFormat附加 境界名以外的文字  | 
|     //needName 指境界0是否需要名称  | 
|     public static string GetRealmNameEx(int realmLv, string strFormat, bool bright = false, bool needName = false)  | 
|     {  | 
|         if (realmLv <= 0 && !needName)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         var config = RealmConfig.Get(realmLv);  | 
|         if (config == null)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         return GetRealmColorByLv(realmLv, string.Format(strFormat, config.Name), bright);  | 
|     }  | 
|   | 
|     public static string GetRealmColorByLv(int realmLv, string msg, bool bright = false)  | 
|     {  | 
|         var config = RealmConfig.Get(realmLv);  | 
|         if (config == null)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         switch (config.Quality)  | 
|         {  | 
|             case 1:  | 
|                 return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", msg, "</color>");  | 
|             case 2:  | 
|                 return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", msg, "</color>");  | 
|             case 3:  | 
|                 return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", msg, "</color>");  | 
|             case 4:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", msg, "</color>");  | 
|             case 5:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", msg, "</color>");  | 
|             case 6:  | 
|                 return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", msg, "</color>");  | 
|             default:  | 
|                 return msg;  | 
|         }  | 
|     }  | 
|   | 
|     public static string AppendColor(int itemColor, string msg, bool bright = false)  | 
|     {  | 
|         switch (itemColor)  | 
|         {  | 
|             case 0:  | 
|             case 1:  | 
|                 return AppendColor(TextColType.White, msg, bright);  | 
|             case 2:  | 
|                 return AppendColor(TextColType.Blue, msg, bright);  | 
|             case 3:  | 
|                 return AppendColor(TextColType.Purple, msg, bright);  | 
|             case 4:  | 
|                 return AppendColor(TextColType.Orange, msg, bright);  | 
|             case 5:  | 
|                 return AppendColor(TextColType.Red, msg, bright);  | 
|             case 6:  | 
|             case 7:  | 
|             case 8:  | 
|                 return AppendColor(TextColType.Pink, msg, bright);  | 
|             case 9:  | 
|                 return AppendColor(TextColType.Green, msg, bright);  | 
|         }  | 
|         return msg;  | 
|     }  | 
|   | 
|     public static int GetItemColor(int _id, Dictionary<int, List<int>> _dict = null)  | 
|     {  | 
|         int _itemColor = 0;  | 
|         var _itemCfg = ItemConfig.Get(_id);  | 
|         if (_itemCfg != null)  | 
|         {  | 
|             _itemColor = _itemCfg.ItemColor;  | 
|             if (_itemCfg.Type == 113 && _dict != null)  | 
|             {  | 
|                 _itemColor = ItemLogicUtility.Instance.GetItemQuality(_itemCfg.ID, _dict);  | 
|             }  | 
|         }  | 
|         return _itemColor;  | 
|     }  | 
|   | 
|     public static Color GetPropertyColor(int property)  | 
|     {  | 
|         switch ((PropertyType)property)  | 
|         {  | 
|             case PropertyType.Mater:  | 
|                 return s_Gold;  | 
|             case PropertyType.Wood:  | 
|                 return s_LightGreen;  | 
|             case PropertyType.Water:  | 
|                 return s_DarkBlueColor;  | 
|             case PropertyType.Fire:  | 
|                 return s_GrayDanLV5;  | 
|             case PropertyType.Earth:  | 
|                 return s_EarthYellow;  | 
|         }  | 
|         return s_NavyBrown;  | 
|     }  | 
|     #endregion  | 
|   | 
|     #region 计算战斗力  | 
|     public static readonly string FightPowerFormula = "FightpowerFormula";  | 
|   | 
|     public static int GetFightPower(Dictionary<int, int> _propertyDict)  | 
|     {  | 
|         Equation.Instance.Clear();  | 
|         if (_propertyDict == null || _propertyDict.Count == 0)  | 
|         {  | 
|             return 0;  | 
|         }  | 
|   | 
|         foreach (var _key in _propertyDict.Keys)  | 
|         {  | 
|             PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(_key);  | 
|             if (cfg != null)  | 
|             {  | 
|                 if (_key == 7)  | 
|                 {  | 
|                     Equation.Instance.AddKeyValue("MinAtk", _propertyDict[_key]);  | 
|                     Equation.Instance.AddKeyValue("MaxAtk", _propertyDict[_key]);  | 
|                 }  | 
|                 else if (_key == 24)  | 
|                 {  | 
|                     Equation.Instance.AddKeyValue("PetMinAtk", _propertyDict[_key]);  | 
|                     Equation.Instance.AddKeyValue("PetMaxAtk", _propertyDict[_key]);  | 
|                 }  | 
|                 else  | 
|                 {  | 
|                     ulong attrValue = (ulong)_propertyDict[_key];  | 
|                     var fightParm = GetFightPowerParmByAttrId(_key);  | 
|                     if (_key == 11)  | 
|                     {  | 
|                         var playerLv = PlayerDatas.Instance.baseData.LV;  | 
|                         var paramConfig = FightPowerParamConfig.Get(playerLv);  | 
|                         Equation.Instance.AddKeyValue("AtkSpeedParameter", paramConfig.AtkSpeedParameter);  | 
|                     }  | 
|                     else  | 
|                     {  | 
|                         if (fightParm != 0)  | 
|                         {  | 
|                             attrValue = attrValue * (ulong)fightParm;  | 
|                         }  | 
|                     }  | 
|                     Equation.Instance.AddKeyValue(cfg.Parameter, attrValue);  | 
|                 }  | 
|             }  | 
|   | 
|         }  | 
|         FuncConfigConfig funcCfg = FuncConfigConfig.Get(FightPowerFormula);  | 
|         return Equation.Instance.Eval<int>(funcCfg.Numerical1);  | 
|     }  | 
|   | 
|     public static int GetFightPowerParmByAttrId(int attrId)  | 
|     {  | 
|         int playerLv = PlayerDatas.Instance.baseData.LV;  | 
|         FightPowerParamConfig paramConfig = FightPowerParamConfig.Get(playerLv);  | 
|         PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(attrId);  | 
|         if (paramConfig == null || cfg == null) return 0;  | 
|   | 
|         switch (cfg.Parameter)  | 
|         {  | 
|             case "Hit":  | 
|                 return paramConfig.Hit;  | 
|             case "Miss":  | 
|                 return paramConfig.Miss;  | 
|             case "IgnoreDefRate":  | 
|                 return paramConfig.IgnoreDefRate;  | 
|             case "DamChanceDef":  | 
|                 return paramConfig.DamChanceDef;  | 
|             case "FaintRate":  | 
|                 return paramConfig.FaintRate;  | 
|             case "LuckyHitRateReduce":  | 
|                 return paramConfig.LuckyHitRateReduce;  | 
|             case "SkillAtkRate":  | 
|                 return paramConfig.SkillAtkRate;  | 
|             case "SkillAtkRateReduce":  | 
|                 return paramConfig.SkillAtkRateReduce;  | 
|             case "DamagePerPVP":  | 
|                 return paramConfig.DamagePerPVP;  | 
|             case "DamagePerPVPReduce":  | 
|                 return paramConfig.DamagePerPVPReduce;  | 
|             case "DamBackPer":  | 
|                 return paramConfig.DamBackPer;  | 
|             case "IgnoreDefRateReduce":  | 
|                 return paramConfig.IgnoreDefRateReduce;  | 
|             case "FaintDefRate":  | 
|                 return paramConfig.FaintDefRate;  | 
|             case "AtkSpeedParameter":  | 
|                 return paramConfig.AtkSpeedParameter;  | 
|             case "JobAHurtAddPer":  | 
|                 return paramConfig.JobAHurtAddPer;  | 
|             case "JobBHurtAddPer":  | 
|                 return paramConfig.JobBHurtAddPer;  | 
|             case "JobCHurtAddPer":  | 
|                 return paramConfig.JobCHurtAddPer;  | 
|             case "JobAAtkReducePer":  | 
|                 return paramConfig.JobAAtkReducePer;  | 
|             case "JobBAtkReducePer":  | 
|                 return paramConfig.JobBAtkReducePer;  | 
|             case "JobCAtkReducePer":  | 
|                 return paramConfig.JobCAtkReducePer;  | 
|             case "SuperHitRate":  | 
|                 return paramConfig.SuperHitRate;  | 
|             case "LuckyHitRate":  | 
|                 return paramConfig.LuckyHitRate;  | 
|             case "SuperHitRateReduce":  | 
|                 return paramConfig.SuperHitRateReduce;  | 
|             case "FinalHurtPer":  | 
|                 return paramConfig.FinalHurtPer;  | 
|             case "FinalHurtReducePer":  | 
|                 return paramConfig.FinalHurtReducePer;  | 
|             case "NPCHurtAddPer":  | 
|                 return paramConfig.NPCHurtAddPer;  | 
|             case "NormalHurtPer":  | 
|                 return paramConfig.NormalHurtPer;  | 
|             case "FabaoHurtPer":  | 
|                 return paramConfig.FabaoHurtPer;  | 
|             case "AffairSpeedPer":  | 
|                 return paramConfig.AffairSpeedPer;  | 
|             case "FamilyBossHurtPer":  | 
|                 return paramConfig.FamilyBossHurtPer;  | 
|             case "FamilyWarHPPer":  | 
|                 return paramConfig.FamilyWarHPPer;  | 
|             case "FamilyWarAtkPer":  | 
|                 return paramConfig.FamilyWarAtkPer;  | 
|             case "FamilySitExpPer":  | 
|                 return paramConfig.FamilySitExpPer;  | 
|             case "BossFinalHurtPer":  | 
|                 return paramConfig.BossFinalHurtPer;  | 
|         }  | 
|   | 
|         return 0;  | 
|     }  | 
|   | 
|     #endregion  | 
|   | 
|     #region 得到金钱数量根据金钱类型  | 
|   | 
|   | 
|     //货币单位的显示,越南盾显示逗号  | 
|     public static string GetMoneyFormat(long money)  | 
|     {  | 
|         return money.ToString("#,0");  | 
|     }  | 
|   | 
|     //仅用于显示 仙玉和灵石的特殊处理,存在负数情况,如GM惩罚扣除货币  | 
|     public static int GetMoneyCntEx(int moneyType)  | 
|     {  | 
|         switch (moneyType)  | 
|         {  | 
|             case 1:  | 
|                 {  | 
|                     return (int)(PlayerDatas.Instance.baseData.diamond - PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default5));  | 
|                 }  | 
|             case 2:  | 
|                 {  | 
|                     return (int)(PlayerDatas.Instance.baseData.bindDiamond - PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default6));  | 
|                 }  | 
|         }  | 
|         return 0;  | 
|     }  | 
|   | 
|   | 
|     public static ulong GetMoneyCnt(int moneyType)  | 
|     {  | 
|         switch (moneyType)  | 
|         {  | 
|             case 1:  | 
|                 {  | 
|                     return PlayerDatas.Instance.baseData.diamond;  | 
|                 }  | 
|             case 2:  | 
|                 {  | 
|                     return PlayerDatas.Instance.baseData.bindDiamond;  | 
|                 }  | 
|             case 3:  | 
|                 {  | 
|                     return PlayerDatas.Instance.baseData.allCopper;  | 
|                 }  | 
|             case 18:  | 
|                 {  | 
|                     return (ulong)PlayerDatas.Instance.extersion.honorValue;  | 
|                 }  | 
|             case 25:  | 
|                 {  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.CDBPlayerRefresh_TreasureScore);  | 
|                     //return (ulong)ModelCenter.Instance.GetModel<StoreModel>().GetTCBPlayerData(PlayerDataType.CDBPlayerRefresh_TreasureScore);  | 
|                 }  | 
|             case 24:  | 
|                 {  | 
|                     return (ulong)PlayerDatas.Instance.extersion.runeChip;  | 
|                 }  | 
|             case 15:  | 
|                 {  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.UnionLiven);  | 
|                     //return (ulong)ModelCenter.Instance.GetModel<StoreModel>().GetTCBPlayerData(PlayerDataType.UnionLiven);  | 
|                 }  | 
|             case 17:  | 
|                 {  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.FBHelpPoint);  | 
|                     //return (ulong)ModelCenter.Instance.GetModel<StoreModel>().GetTCBPlayerData(PlayerDataType.FBHelpPoint);  | 
|                 }  | 
|             case 27:  | 
|                 {  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.CDBPlayerRefresh_Danjing);  | 
|                     //return (ulong)ModelCenter.Instance.GetModel<StoreModel>().GetTCBPlayerData(PlayerDataType.CDBPlayerRefresh_Danjing);  | 
|                 }  | 
|             case 28:  | 
|                 {  | 
|                     return PlayerDatas.Instance.extersion.soulDust; //废弃了用44  | 
|                 }  | 
|             case 29:  | 
|                 {  | 
|                     return PlayerDatas.Instance.extersion.soulSplinters;  | 
|                 }  | 
|             case 30:  | 
|                 {  | 
|                     return PlayerDatas.Instance.extersion.soulCore;  | 
|                 }  | 
|             case 32:  | 
|                 {  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default4);  | 
|                 }  | 
|             case 34:  | 
|                 {  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default13);  | 
|                 }  | 
|             case 35:  | 
|                 {  | 
|                     //功德点  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default14);  | 
|                 }  | 
|             case 37:  | 
|                 {  | 
|                     //机缘点  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default17);  | 
|                 }  | 
|             case 39:  | 
|                 {  | 
|                     //成就积分  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default19);  | 
|                 }  | 
|             case 40:  | 
|                 {  | 
|                     //万界积分  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default20);  | 
|                 }  | 
|             case 41:  | 
|                 {  | 
|                     //符印精华  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.RuneSplinters);  | 
|                 }  | 
|             case 43:  | 
|                 {  | 
|                     //凭证积分  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default34);  | 
|                 }  | 
|             case 44:  | 
|                 {  | 
|                     //聚魂精华  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default35);  | 
|                 }  | 
|             case 45:  | 
|                 {  | 
|                     //骑宠积分  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default37);  | 
|                 }  | 
|             case 46:  | 
|                 {  | 
|                     //古宝养成货币  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default38);  | 
|                 }  | 
|             case 47:  | 
|                 {  | 
|                     //天道币  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default39);  | 
|                 }  | 
|             case 48:  | 
|                 {  | 
|                     //推金币次数  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default40);  | 
|                 }  | 
|             case 49:  | 
|                 {  | 
|                     //仙缘积分  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default42);  | 
|                 }  | 
|             case 50:  | 
|                 {  | 
|                     //幻境阁积分  | 
|                     return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default43);  | 
|                 }  | 
|             case 99:  | 
|                 {  | 
|                     return PlayerDatas.Instance.baseData.ExAttr11;  | 
|                 }  | 
|         }  | 
|         return 0;  | 
|     }  | 
|     #endregion  | 
|   | 
|     #region 得到装备位对应的部位名称  | 
|     public static string GetEquipPlaceName(int place)  | 
|     {  | 
|         if (GeneralDefine.equipPlaceNameDict.ContainsKey(place))  | 
|         {  | 
|             return GeneralDefine.equipPlaceNameDict[place];  | 
|         }  | 
|         return "";  | 
|     }  | 
|     #endregion  | 
|   | 
|     #region 服务端发过来文字显示不出来问题  | 
|     public static string ServerStringTrim(string str)  | 
|     {  | 
|         if (!string.IsNullOrEmpty(str))  | 
|         {  | 
|             str = str.Replace("\0", "");  | 
|             str = str.Replace("\x00", "");  | 
|             return str;  | 
|         }  | 
|         else  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|     }  | 
|     #endregion  | 
|   | 
|     //账号:706907@1@hyyngame@s30,服务器ID:30  | 
|     public static int GetServerIDByAccount(string account)  | 
|     {  | 
|         string[] strArray = account.Split('@');  | 
|         if (strArray.Length < 2)  | 
|         {  | 
|             //判断长度2不是一个实际长度,一般都是大于2  | 
|             return 0;  | 
|         }  | 
|         if (strArray[strArray.Length - 1].Length < 2)  | 
|             return 0;  | 
|         int id = 0;  | 
|         int.TryParse(strArray[strArray.Length - 1].Substring(1), out id);  | 
|         return id;  | 
|     }  | 
|   | 
|   | 
|     #region 获取间隔奖励  | 
|     public static int GetIntervalAward(ICollection<int> _keys, int _present)  | 
|     {  | 
|         foreach (var _key in _keys)  | 
|         {  | 
|             if (_present <= _key)  | 
|             {  | 
|                 return _key;  | 
|             }  | 
|         }  | 
|         return _keys.Last();  | 
|     }  | 
|     #endregion  | 
|   | 
|     public static string GetGrade(int _star)  | 
|     {  | 
|         switch (_star)  | 
|         {  | 
|             case 5:  | 
|                 return "S";  | 
|             case 4:  | 
|                 return "A";  | 
|             case 3:  | 
|                 return "B";  | 
|             case 2:  | 
|                 return "C";  | 
|             case 1:  | 
|                 return "D";  | 
|         }  | 
|         return "D";  | 
|     }  | 
|   | 
|     public static string TrimContentToServer(string content)  | 
|     {  | 
|         content = WordAnalysis.Color_Start_Regex.Replace(content, string.Empty);  | 
|         content = WordAnalysis.Color_End_Regex.Replace(content, string.Empty);  | 
|         content = content.Replace("=", string.Empty);  | 
|         content = content.Replace(" ", string.Empty);  | 
|         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 minlength = 3;  | 
|         if (length > maxlength)  | 
|         {  | 
|             error = 1;  | 
|         }  | 
|         else if (length < minlength)  | 
|         {  | 
|             error = 2;  | 
|         }  | 
|         return error == 0;  | 
|     }  | 
|   | 
|     public static int GetChsCount(string name)  | 
|     {  | 
|         var count = 0;  | 
|         for (int i = 0; i < name.Length; i++)  | 
|         {  | 
|             if (Regex.IsMatch(name[i].ToString(), "[\u4e00-\u9fa5]"))  | 
|             {  | 
|                 count++;  | 
|             }  | 
|         }  | 
|         return count;  | 
|     }  | 
|   | 
|     public static string GetEquipSuitName(int itemId, bool bright = false)  | 
|     {  | 
|         if (ItemLogicUtility.Instance.IsSuitEquip(itemId))  | 
|         {  | 
|             var itemConfig = ItemConfig.Get(itemId);  | 
|             return AppendColor(TextColType.Green, EquipModel.GetSuitName(itemConfig.LV), bright);  | 
|         }  | 
|         return string.Empty;  | 
|     }  | 
|   | 
|     public static string GetItemName(int itmeId, bool bright = false)  | 
|     {  | 
|         var itemConfig = ItemConfig.Get(itmeId);  | 
|         if (itemConfig == null)  | 
|         {  | 
|             return string.Empty;  | 
|         }  | 
|         return StringUtility.Contact(GetEquipSuitName(itmeId, bright), itemConfig.ItemName);  | 
|     }  | 
|   | 
|     public static string GetStar(int star)  | 
|     {  | 
|         switch (star)  | 
|         {  | 
|             case 5:  | 
|                 return "S";  | 
|             case 4:  | 
|                 return "A";  | 
|             case 3:  | 
|                 return "B";  | 
|             case 2:  | 
|                 return "C";  | 
|             case 1:  | 
|                 return "D";  | 
|         }  | 
|         return string.Empty;  | 
|     }  | 
|   | 
|   | 
|     //转为s1,s2,s3格式  | 
|     public static string GetServers(string serverIDRangeInfo)  | 
|     {  | 
|         var serverList = new List<string>();  | 
|         if (string.IsNullOrEmpty(serverIDRangeInfo) || serverIDRangeInfo == "[]")  | 
|         {  | 
|             return "all";  | 
|         }  | 
|   | 
|         var serverArray = JsonMapper.ToObject<int[][]>(serverIDRangeInfo);  | 
|   | 
|         for (int i = 0; i < serverArray.Length; i++)  | 
|         {  | 
|             int startID = serverArray[i][0];  | 
|             int endID = serverArray[i][1];  | 
|             for (int j = startID; j <= endID; j++)  | 
|             {  | 
|                 var serverName = ServerListCenter.Instance.GetServerName(j);  | 
|                 serverList.Add(serverName);  | 
|                 //太长会导致界面顶点数超过65000  | 
|                 if (serverList.Count > 1000)  | 
|                     return string.Join(", ", serverList.ToArray());  | 
|             }  | 
|         }  | 
|         return string.Join(", ", serverList.ToArray());  | 
|     }  | 
|   | 
| }  |