少年修仙传客户端代码仓库
client_linchunjie
2018-11-26 af26fee978046648165ae791392dbd1558cafc27
4736  【1.3】神兵系统界面逻辑修改(防护值属性保留2位小数)
2个文件已修改
36 ■■■■■ 已修改文件
System/Role/PropertyBehaviour.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Utility/UIHelper.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/PropertyBehaviour.cs
@@ -18,7 +18,8 @@
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage)),
                m_PropertyValue.text = StringUtility.Contact(
                    UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
            }
        }
@@ -29,7 +30,8 @@
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage)),
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
            }
        }
@@ -40,7 +42,8 @@
            if (config != null)
            {
                m_PropertyName.text = StringUtility.Contact(config.Name, ":");
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage)),
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
            }
        }
@@ -51,7 +54,8 @@
            if (config != null)
            {
                m_PropertyName.text = StringUtility.Contact(config.Name, ":");
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage)),
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
                if (_add == 0)
                {
@@ -59,7 +63,8 @@
                }
                else
                {
                    m_PropertyAdd.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_add, config.ISPercentage)),
                    m_PropertyAdd.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                        UIHelper.ReplacePercentage(_add, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                       config.ISPercentage == 1 ? "%" : string.Empty);
                }
            }
@@ -71,9 +76,11 @@
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage)),
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
                m_PropertyAdd.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_add, config.ISPercentage)),
                m_PropertyAdd.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_add, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                   config.ISPercentage == 1 ? "%" : string.Empty);
            }
        }
Utility/UIHelper.cs
@@ -306,11 +306,11 @@
        return _textBuilder.ToString();
    }
    public static float ReplacePercentage(float num, int isPer)
    public static float ReplacePercentage(float num, int isPer, int decimals = 1)
    {
        if (isPer == 1 || isPer == 2)
        {
            return (float)Math.Round(num / 100, 1);
            return (float)Math.Round(num / 100, decimals);
        }
        else
        {
@@ -318,6 +318,17 @@
        }
    }
    public static int GetPropertyDecimalCount(int property)
    {
        switch (property)
        {
            case 73:
                return 2;
            default:
                return 1;
        }
    }
    private const string SPECIAL_CHA = " ()()@!#$%^&*[]|_";
    public static bool HasSpecialCharac(string str)
    {