コード例 #1
0
    public static string GetAttrValueDisplay(AttrType type, long value)
    {
        int attrValueDisplayMode = AttrUtility.GetAttrValueDisplayMode(type);

        if (attrValueDisplayMode != 1)
        {
            if (attrValueDisplayMode != 2)
            {
                return(((int)value).ToString());
            }
            long num = 0L;
            if ((double)value >= 1000000000000.0)
            {
                double num2 = (double)value / 1000000000000.0;
                if (long.TryParse(num2.ToString(), ref num))
                {
                    return(string.Format(GameDataUtils.GetChineseContent(16, false), num.ToString()));
                }
                return(string.Format(GameDataUtils.GetChineseContent(16, false), Math.Round(num2, 2).ToString("F2")));
            }
            else if ((double)value >= 100000000.0)
            {
                double num2 = (double)value / 100000000.0;
                if (long.TryParse(num2.ToString(), ref num))
                {
                    return(string.Format(GameDataUtils.GetChineseContent(15, false), num.ToString()));
                }
                return(string.Format(GameDataUtils.GetChineseContent(15, false), Math.Round(num2, 2).ToString("F2")));
            }
            else
            {
                if ((double)value < 100000.0)
                {
                    return(value.ToString());
                }
                double num2 = (double)value / 10000.0;
                if (long.TryParse(num2.ToString(), ref num))
                {
                    return(string.Format(GameDataUtils.GetChineseContent(14, false), num.ToString()));
                }
                return(string.Format(GameDataUtils.GetChineseContent(14, false), Math.Round(num2, 1).ToString("F1")));
            }
        }
        else
        {
            int num3 = 0;
            if (int.TryParse(((double)value * 0.1).ToString(), ref num3))
            {
                return(string.Format("{0}%", num3.ToString()));
            }
            return(string.Format("{0}%", Math.Round((double)value * 0.1, 1).ToString("F1")));
        }
    }
コード例 #2
0
 public static int GetAttrValueDisplayMode(int typeNum)
 {
     return(AttrUtility.GetAttrValueDisplayMode((AttrType)typeNum));
 }
コード例 #3
0
 private bool IsFormatPercent(int attrType)
 {
     return(AttrUtility.GetAttrValueDisplayMode(attrType) == 1);
 }