| | |
| | | public static void SetIconWithMoneyType(this Image _image, int moneyType) |
| | | { |
| | | if (_image == null) return; |
| | | // string iconKey = StringUtility.Contact("Money_Type_", moneyType); |
| | | if (GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType)) |
| | | { |
| | | _image.SetOrgSprite(ItemConfig.Get(GeneralDefine.MoneyDisplayModel[moneyType]).IconKey); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("MoneyDisplayModel 为配置货币类型:" + moneyType); |
| | | { |
| | | // 不需要物品的情况补充 |
| | | // string iconKey = StringUtility.Contact("Money_Type_", moneyType); |
| | | Debug.LogError("MoneyDisplayModel 未配置货币类型:" + moneyType); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("MoneyDisplayModel 为配置货币类型:" + moneyType); |
| | | Debug.LogError("MoneyDisplayModel 未配置货币类型:" + moneyType); |
| | | return ""; |
| | | } |
| | | } |
| | |
| | | public static readonly Color s_NavyYellow = new Color32(242, 238, 2, 255); //f2ee02 |
| | | public static readonly Color s_LightGreen = new Color32(42, 227, 55, 255);//2ae337 |
| | | public static readonly Color s_LightWhite = new Color32(245, 246, 230, 255); //f5f6e6 |
| | | public static readonly Color s_Gray = new Color32(104, 104, 104,255); //bbbbbb |
| | | public static readonly Color s_Gray = new Color32(187, 187, 187, 255); //bbbbbb |
| | | 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 |
| | | |
| | |
| | | return s_LightWhite; |
| | | case TextColType.Gray: |
| | | return s_Gray; |
| | | case TextColType.NavyGray: |
| | | return new Color32(121, 121, 121, 255); |
| | | case TextColType.itemjingliang: |
| | | // 729de4 精良 |
| | | return new Color32(114, 157, 228, 255); |
| | |
| | | // 5d1d52 永恒 |
| | | return new Color32(93, 29, 82, 128); |
| | | case QualityTextColType.red: |
| | | return s_BrightRedColor; |
| | | return s_DarkRedColor; |
| | | } |
| | | return new Color32(0, 0, 0, 128); |
| | | } |
| | |
| | | return StringUtility.Contact("<color=#8ddc11>", msg, "</color>"); |
| | | case TextColType.Gray: |
| | | return StringUtility.Contact("<color=#bbbbbb>", msg, "</color>"); |
| | | case TextColType.NavyGray: |
| | | return StringUtility.Contact("<color=#797979>", msg, "</color>"); |
| | | case TextColType.lightYellow: |
| | | return StringUtility.Contact("<color=#fcedb9>", msg, "</color>"); |
| | | case TextColType.NavyYellow: |
| | |
| | | return StringUtility.Contact("<color=#dfbbed>", msg, "</color>"); |
| | | case TextColType.itembuxiu: |
| | | // 5eeff2 不朽 |
| | | return StringUtility.Contact("<color=#5eeff2>", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#5eeff2>", msg, "</color>"); |
| | | case TextColType.itemyonghen: |
| | | // f5b4ea 永恒 |
| | | return StringUtility.Contact("<color=#f5b4ea>", msg, "</color>"); |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | public static string AppendColor(Color color, string msg) |
| | | { |
| | | return StringUtility.Contact("<color=#", ColorToHexWithHash(color), ">", msg, "</color>"); |
| | | } |
| | | |
| | | |
| | | public static string ColorToHexWithHash(Color color, bool includeAlpha = false) |
| | | { |
| | | int r = Mathf.RoundToInt(color.r * 255); |
| | | int g = Mathf.RoundToInt(color.g * 255); |
| | | int b = Mathf.RoundToInt(color.b * 255); |
| | | if (includeAlpha) |
| | | { |
| | | int a = Mathf.RoundToInt(color.a * 255); |
| | | return string.Format("{0:X2}{1:X2}{2:X2}{3:X2}", r, g, b, a); |
| | | } |
| | | else |
| | | { |
| | | return string.Format("{0:X2}{1:X2}{2:X2}", r, g, b); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //needName 指官职0是否需要名称 |
| | | public static string GetRealmName(int realmLv, bool bright = true, bool needName = false) |
| | |
| | | /// <param name="itemColor"></param> |
| | | /// <param name="msg"></param> |
| | | /// <param name="bright"></param> |
| | | /// <param name="colorGroupType"></param> |
| | | /// <param name="colorGroupType">0 通用功能品质分组精良到神话</param> |
| | | /// <returns></returns> |
| | | public static string AppendColor(int itemColor, string msg, bool bright = true, int colorGroupType = 0) |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | #region 得到金钱数量根据金钱类型 |
| | | |
| | |
| | | //武将招募积分 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default44); |
| | | } |
| | | case 52: |
| | | { |
| | | //淘金令 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.GoldRush); |
| | | } |
| | | case 98: |
| | | { |
| | | //过期型代金券 |
| | |
| | | public static string ShowUseMoney(int moneyType, long useCnt, TextColType engoughColor = TextColType.Green) |
| | | { |
| | | long cnt = GetMoneyCnt(moneyType); |
| | | return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(useCnt)}/{ReplaceLargeNum(cnt)}"); |
| | | return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(cnt)}/{ReplaceLargeNum(useCnt)}"); |
| | | } |
| | | |
| | | public static string ShowUseItem(PackType type, int itemId, long useCnt, TextColType engoughColor = TextColType.Green) |
| | | { |
| | | long cnt = PackManager.Instance.GetItemCountByID(type, itemId); |
| | | return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(useCnt)}/{ReplaceLargeNum(cnt)}"); |
| | | return AppendColor(useCnt <= cnt ? engoughColor : TextColType.Red, $"{ReplaceLargeNum(cnt)}/{ReplaceLargeNum(useCnt)}"); |
| | | } |
| | | |
| | | |
| | | /// <param name="needTips">0 不响应 1 弹提示 2 弹获取途径tips</param> |
| | | public static bool CheckMoneyCount(int moneyType, long needCount, int needTips = 0) |
| | | { |
| | | if (needCount <= 0) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | long haveCount = GetMoneyCnt(moneyType); |
| | | |
| | | bool isEnough = haveCount >= needCount; |
| | | |
| | | if (!isEnough) |
| | | { |
| | | if (needTips == 1) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", moneyType); |
| | | } |
| | | else if (needTips == 2) |
| | | { |
| | | ItemTipUtility.ShowMoneyTip(moneyType); |
| | | } |
| | | } |
| | | |
| | | return isEnough; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 得到装备位或者祝福树品质名称 带颜色 |
| | | public static string GetQualityNameWithColor(int quality, string format="{0}") |
| | | public static string GetQualityNameWithColor(int quality, string format = "{0}") |
| | | { |
| | | return AppendColor(quality, string.Format(format, Language.Get("equipQuality" + quality)), true, 1); |
| | | } |
| | |
| | | return money / scale; |
| | | } |
| | | |
| | | |
| | | 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; |
| | | } |
| | | } |