少年修仙传客户端代码仓库
client_linchunjie
2019-06-10 97c753d8e6014aeefd6d6a47d01f7fcda3e4fbf7
7179 【前端】【2.0】百分比属性保留X位小数
10个文件已修改
166 ■■■■ 已修改文件
Core/GameEngine/Model/Config/PlayerPropertyConfig.cs 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/PlayerPropertyConfigWrap.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/UIHelperWrap.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/PropertyBehaviour.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/ReikiQualityCell.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Role/RolePropertyBehaviour.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Rune/RuneModel.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Utility/UIHelper.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/PlayerPropertyConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:           Fish
//    [  Date ]:           Wednesday, May 15, 2019
//    [  Date ]:           Monday, June 10, 2019
//--------------------------------------------------------
using System.Collections.Generic;
@@ -13,11 +13,12 @@
public partial class PlayerPropertyConfig
{
    public readonly int ID;
    public readonly string Name;
    public readonly int ISPercentage;
    public readonly int type;
    public readonly string desc;
    public readonly int ID;
    public readonly string Name;
    public readonly int ISPercentage;
    public readonly int type;
    public readonly int decimalCount;
    public readonly string desc;
    public readonly string Parameter;
    public PlayerPropertyConfig()
@@ -30,17 +31,19 @@
        {
            var tables = input.Split('\t');
            int.TryParse(tables[0],out ID);
            Name = tables[1];
            int.TryParse(tables[2],out ISPercentage);
            int.TryParse(tables[3],out type);
            desc = tables[4];
            Parameter = tables[5];
            int.TryParse(tables[0],out ID);
            Name = tables[1];
            int.TryParse(tables[2],out ISPercentage);
            int.TryParse(tables[3],out type);
            int.TryParse(tables[4],out decimalCount);
            desc = tables[5];
            Parameter = tables[6];
        }
        catch (Exception ex)
        {
Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 2deaa7d02e386a54a997be559b9f935b
timeCreated: 1557892564
timeCreated: 1560135998
licenseType: Pro
MonoImporter:
  serializedVersion: 2
Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
@@ -67,10 +67,10 @@
    public static string GetValueDescription(int id, int value)
    {
        return GetValueDescription(id, value, 1, false);
        return GetValueDescription(id, value, false);
    }
    public static string GetValueDescription(int id, int value, int decimalCount, bool largeValue)
    public static string GetValueDescription(int id, int value, bool largeValue)
    {
        var config = Get(id);
        if (config == null)
@@ -85,11 +85,11 @@
        }
        else if (config.ISPercentage == 1)
        {
            result = (float)Math.Round(value / 100f, decimalCount);
            result = (float)Math.Round(value / 100f, config.decimalCount);
        }
        else if (config.ISPercentage == 2)
        {
            result = (float)Math.Round(value / 100f, decimalCount);
            result = (float)Math.Round(value / 100f, config.decimalCount);
        }
        var label = string.Empty;
Lua/Gen/PlayerPropertyConfigWrap.cs
@@ -46,7 +46,6 @@
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Init", _m_Init_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetPropByType", _m_GetPropByType_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetFullDescription", _m_GetFullDescription_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetValueDescription", _m_GetValueDescription_xlua_st_);
            
            
            
@@ -363,66 +362,6 @@
            return LuaAPI.luaL_error(L, "invalid arguments to PlayerPropertyConfig.GetFullDescription!");
            
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetValueDescription_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                int gen_param_count = LuaAPI.lua_gettop(L);
                if(gen_param_count == 2&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
                {
                    int _id = LuaAPI.xlua_tointeger(L, 1);
                    int _value = LuaAPI.xlua_tointeger(L, 2);
                        string gen_ret = PlayerPropertyConfig.GetValueDescription( _id, _value );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    return 1;
                }
                if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 4))
                {
                    int _id = LuaAPI.xlua_tointeger(L, 1);
                    int _value = LuaAPI.xlua_tointeger(L, 2);
                    int _decimalCount = LuaAPI.xlua_tointeger(L, 3);
                    bool _largeValue = LuaAPI.lua_toboolean(L, 4);
                        string gen_ret = PlayerPropertyConfig.GetValueDescription( _id, _value, _decimalCount, _largeValue );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    return 1;
                }
                if(gen_param_count == 1&& translator.Assignable<Int2>(L, 1))
                {
                    Int2 _property;translator.Get(L, 1, out _property);
                        string gen_ret = PlayerPropertyConfig.GetValueDescription( _property );
                        LuaAPI.lua_pushstring(L, gen_ret);
                    return 1;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return LuaAPI.luaL_error(L, "invalid arguments to PlayerPropertyConfig.GetValueDescription!");
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_inited(RealStatePtr L)
Lua/Gen/UIHelperWrap.cs
@@ -41,7 +41,6 @@
            Utils.RegisterFunc(L, Utils.CLS_IDX, "ReplaceLargeNum", _m_ReplaceLargeNum_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "ReplaceXianYuanCoinsNum", _m_ReplaceXianYuanCoinsNum_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "ReplacePercentage", _m_ReplacePercentage_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetPropertyDecimalCount", _m_GetPropertyDecimalCount_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "HasSpecialCharac", _m_HasSpecialCharac_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetColorNameByItemColor", _m_GetColorNameByItemColor_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetDanLVColor", _m_GetDanLVColor_xlua_st_);
@@ -366,31 +365,6 @@
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to UIHelper.ReplacePercentage!");
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetPropertyDecimalCount_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    int _property = LuaAPI.xlua_tointeger(L, 1);
                        int gen_ret = UIHelper.GetPropertyDecimalCount( _property );
                        LuaAPI.xlua_pushinteger(L, gen_ret);
                    return 1;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
System/Role/PropertyBehaviour.cs
@@ -57,7 +57,7 @@
        {
            m_PropertyName.text = GetPropertyName(_property);
            m_PropertyValue.text = StringUtility.Contact("+",
                PlayerPropertyConfig.GetValueDescription(_property, _value, 2, false));
                PlayerPropertyConfig.GetValueDescription(_property, _value, false));
        }
        string GetPropertyName(int property)
@@ -109,8 +109,7 @@
        string GetValueLabel(int _property, int _value)
        {
            var decimalCount = UIHelper.GetPropertyDecimalCount(_property);
            return PlayerPropertyConfig.GetValueDescription(_property, _value, decimalCount, true);
            return PlayerPropertyConfig.GetValueDescription(_property, _value, true);
        }
        public void SetColor(TextColType colorType, bool bright)
System/Role/ReikiQualityCell.cs
@@ -48,8 +48,7 @@
                         return x.property == property;
                     });
                    var value = model.GetQualityProperty(quality, qualityProperty.propertyValues);
                    var decimalCount = UIHelper.GetPropertyDecimalCount(property);
                    m_PropertyValues[i].text = "+" + PlayerPropertyConfig.GetValueDescription(property, value, decimalCount, true);
                    m_PropertyValues[i].text = "+" + PlayerPropertyConfig.GetValueDescription(property, value, true);
                }
            }
        }
System/Role/RolePropertyBehaviour.cs
@@ -50,8 +50,8 @@
            {
                var minAtk = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.MINATK);
                var maxAtk = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.MAXATK);
                var minAtkLabel = PlayerPropertyConfig.GetValueDescription((int)propertyType, minAtk, 2, true);
                var maxAtkLabel = PlayerPropertyConfig.GetValueDescription((int)propertyType, maxAtk, 2, true);
                var minAtkLabel = PlayerPropertyConfig.GetValueDescription((int)propertyType, minAtk, true);
                var maxAtkLabel = PlayerPropertyConfig.GetValueDescription((int)propertyType, maxAtk, true);
                return StringUtility.Contact(minAtkLabel, "-", maxAtkLabel);
            }
            else
@@ -60,9 +60,9 @@
                switch (propertyType)
                {
                    case PropertyType.ATKSPEED:
                        return PlayerPropertyConfig.GetValueDescription((int)propertyType, value, 1, true);
                        return PlayerPropertyConfig.GetValueDescription((int)propertyType, value, true);
                    default:
                        return PlayerPropertyConfig.GetValueDescription((int)propertyType, value, 2, true);
                        return PlayerPropertyConfig.GetValueDescription((int)propertyType, value, true);
                }
            }
        }
System/Rune/RuneModel.cs
@@ -287,9 +287,8 @@
                var property = config.AttrType[i];
                var propertyConfig = PlayerPropertyConfig.Get(property);
                var propertyValue = GetPropertyValue(id, level, property);
                var decimalCount = UIHelper.GetPropertyDecimalCount(property);
                var label = StringUtility.Contact(propertyConfig.Name, "+",
                    PlayerPropertyConfig.GetValueDescription(property, propertyValue, decimalCount, false));
                    PlayerPropertyConfig.GetValueDescription(property, propertyValue, false));
                sb.Append(label);
                if (i < config.AttrType.Length - 1)
                {
Utility/UIHelper.cs
@@ -382,19 +382,6 @@
        }
    }
    public static int GetPropertyDecimalCount(int property)
    {
        switch (property)
        {
            case 73:
                return 2;
            case 29:
                return 2;
            default:
                return 1;
        }
    }
    static Regex s_SpecialCharacterRegex = new Regex("[ ()()@!#$%^&*[]|_]");
    static Regex s_AsciiCharacterRegex = new Regex("[\x00-\x2F]|[\x3A-\x40]|[\x5B-\x60]|[\x7B-\x7E]");
    public static bool HasSpecialCharac(string str)