| | |
| | | } |
| | | } |
| | | |
| | | // 通过货币类型获取物品ID |
| | | public static int GetItemIDWithMoneyType(int moneyType) |
| | | { |
| | | if (GeneralDefine.MoneyDisplayModel.ContainsKey(moneyType)) |
| | | { |
| | | return GeneralDefine.MoneyDisplayModel[moneyType]; |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("MoneyDisplayModel 未配置货币类型:" + moneyType); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分离字符串插入空格 |
| | | /// </summary> |
| | |
| | | /// 大数值转化 格式 最多两个小数 ,向下取整 |
| | | /// K -千,M -百萬,B-十億,T -萬億 |
| | | /// </summary> |
| | | public static string ReplaceLargeNum(double num) |
| | | public static string ReplaceLargeNum(double num, int decimalPlaces = 1) |
| | | { |
| | | const long K = 10000; //国内为万,海外为千 |
| | | const long M = K * 10000; |
| | |
| | | } |
| | | else if (num >= M) |
| | | { |
| | | return StringUtility.Contact(FormatWithoutRounding(num / M, 1), Language.Get("L1070")); |
| | | return StringUtility.Contact(FormatWithoutRounding(num / M, decimalPlaces), Language.Get("L1070")); |
| | | } |
| | | else if (num >= K) |
| | | { |
| | | return StringUtility.Contact(FormatWithoutRounding(num / K, 1), Language.Get("L1071")); |
| | | return StringUtility.Contact(FormatWithoutRounding(num / K, decimalPlaces), Language.Get("L1071")); |
| | | } |
| | | else |
| | | { |
| | | return FormatWithoutRounding(num, 1); |
| | | return FormatWithoutRounding(num, decimalPlaces); |
| | | } |
| | | } |
| | | |