少年修仙传客户端代码仓库
client_linchunjie
2019-03-14 edc1f81bb22c7b31d75e468c1190601f22bac864
3335 修改属性显示代码
2个文件已修改
172 ■■■■■ 已修改文件
Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/PropertyBehaviour.cs 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
@@ -30,26 +30,43 @@
    public static string GetPropertyDescription(int propertyId, int value)
    {
        return GetPropertyDescription(propertyId, value, 1, false);
    }
    public static string GetPropertyDescription(int propertyId, int value, int decimalCount, bool largeValue)
    {
        var config = Get(propertyId);
        if (config == null)
        {
            return string.Empty;
        }
        float _result = 0f;
        if (config.ISPercentage == 0)
        {
            return value.ToString();
            _result = value;
        }
        else if (config.ISPercentage == 1)
        {
            return (float)Math.Round(value / 100f, 1) + "%";
            _result = (float)Math.Round(value / 100f, decimalCount);
        }
        else if (config.ISPercentage == 2)
        {
            return ((float)Math.Round(value / 100f, 1)).ToString();
            _result = (float)Math.Round(value / 100f, decimalCount);
        }
        return string.Empty;
        var label = string.Empty;
        if (largeValue)
        {
            label = UIHelper.ReplaceLargeNum(_result);
        }
        else
        {
            label = _result.ToString();
        }
        return config.ISPercentage == 1 ? (label + "%") : label;
    }
}
System/Role/PropertyBehaviour.cs
@@ -15,130 +15,75 @@
        public void Display(int _property, int _value)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact(
                    UIHelper.ReplaceLargeNum(UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
            }
            m_PropertyName.text = GetPropertyName(_property);
            m_PropertyValue.text = GetValueLabel(_property, _value);
        }
        public void DisplayUpper(int _property, int _value)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
            }
        }
        public void DisplayColon(int _property, int _value)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = StringUtility.Contact(config.Name, ":");
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
            }
            m_PropertyName.text = GetPropertyName(_property);
            m_PropertyValue.text = GetAddValueLabel(_property, _value);
        }
        public void DisplayAdd(int _property, int _value, int _add)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = StringUtility.Contact(config.Name, ":");
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
                if (_add == 0)
                {
                    m_PropertyAdd.text = string.Empty;
                }
                else
                {
                    m_PropertyAdd.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                        UIHelper.ReplacePercentage(_add, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                       config.ISPercentage == 1 ? "%" : string.Empty);
                }
            }
            m_PropertyName.text = StringUtility.Contact(GetPropertyName(_property), ":");
            m_PropertyValue.text = GetValueLabel(_property, _value);
            DisplayAddLabel(_property, _add);
        }
        public void DisplayGodWeaponAdd(int _property, int _value, int _add)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
                if (_add == 0)
                {
                    m_PropertyAdd.text = string.Empty;
                }
                else
                {
                    m_PropertyAdd.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                        UIHelper.ReplacePercentage(_add, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                       config.ISPercentage == 1 ? "%" : string.Empty);
                }
            }
        }
        public void DisplayCompare(int _property, int _value, int _add)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                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, UIHelper.GetPropertyDecimalCount(_property))),
                   config.ISPercentage == 1 ? "%" : string.Empty);
            }
            m_PropertyName.text = GetPropertyName(_property);
            m_PropertyValue.text = GetValueLabel(_property, _value);
            DisplayAddLabel(_property, _add);
        }
        public void DisplayUp(int _property, int _value, int _add)
        {
            var config = PlayerPropertyConfig.Get(_property);
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                    UIHelper.ReplacePercentage(_value, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                    config.ISPercentage == 1 ? "%" : string.Empty);
                if (_add == 0)
                {
                    m_PropertyAdd.text = string.Empty;
                }
                else
                {
                    m_PropertyAdd.text = StringUtility.Contact("+", UIHelper.ReplaceLargeNum(
                        UIHelper.ReplacePercentage(_add, config.ISPercentage, UIHelper.GetPropertyDecimalCount(_property))),
                       config.ISPercentage == 1 ? "%" : string.Empty);
                }
            }
            m_PropertyName.text = GetPropertyName(_property);
            m_PropertyValue.text = GetAddValueLabel(_property, _value);
            DisplayAddLabel(_property, _add);
        }
        public void DisplayGem(int _property, int _value)
        {
            var config = PlayerPropertyConfig.Get(_property);
            m_PropertyName.text = GetPropertyName(_property);
            m_PropertyValue.text = StringUtility.Contact("+",
                PlayerPropertyConfig.GetPropertyDescription(_property, _value, 2, false));
        }
        string GetPropertyName(int property)
        {
            var config = PlayerPropertyConfig.Get(property);
            if (config != null)
            {
                m_PropertyName.text = config.Name;
                m_PropertyValue.text = StringUtility.Contact("+", UIHelper.ReplacePercentage(_value,
                    config.ISPercentage, config.ISPercentage == 1 ? 2 : 1), config.ISPercentage == 1 ? "%" : string.Empty);
                return config.Name;
            }
            return string.Empty;
        }
        void DisplayAddLabel(int _property, int _value)
        {
            if (_value == 0)
            {
                m_PropertyAdd.text = string.Empty;
            }
            else
            {
                m_PropertyAdd.text = GetAddValueLabel(_property, _value);
            }
        }
        string GetAddValueLabel(int _property, int _value)
        {
            return StringUtility.Contact("+", GetValueLabel(_property, _value));
        }
        string GetValueLabel(int _property, int _value)
        {
            var decimalCount = UIHelper.GetPropertyDecimalCount(_property);
            return PlayerPropertyConfig.GetPropertyDescription(_property, _value, decimalCount, true);
        }
        public void SetColor(TextColType colorType, bool bright)