From 97c753d8e6014aeefd6d6a47d01f7fcda3e4fbf7 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期一, 10 六月 2019 11:12:26 +0800
Subject: [PATCH] 7179 【前端】【2.0】百分比属性保留X位小数
---
System/Role/ReikiQualityCell.cs | 3
System/Role/RolePropertyBehaviour.cs | 8 +-
Core/GameEngine/Model/Config/PlayerPropertyConfig.cs | 37 ++++++-----
Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta | 2
Lua/Gen/UIHelperWrap.cs | 26 --------
Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs | 8 +-
System/Role/PropertyBehaviour.cs | 5 -
Lua/Gen/PlayerPropertyConfigWrap.cs | 61 --------------------
System/Rune/RuneModel.cs | 3
Utility/UIHelper.cs | 13 ----
10 files changed, 33 insertions(+), 133 deletions(-)
diff --git a/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs b/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs
index 51f5f3d..51a7bc8 100644
--- a/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs
+++ b/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)
{
diff --git a/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta b/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta
index a0f493a..62858a1 100644
--- a/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta
+++ b/Core/GameEngine/Model/Config/PlayerPropertyConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 2deaa7d02e386a54a997be559b9f935b
-timeCreated: 1557892564
+timeCreated: 1560135998
licenseType: Pro
MonoImporter:
serializedVersion: 2
diff --git a/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs b/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
index 0133f8c..fb0ebab 100644
--- a/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
+++ b/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;
diff --git a/Lua/Gen/PlayerPropertyConfigWrap.cs b/Lua/Gen/PlayerPropertyConfigWrap.cs
index ce544ea..71916f9 100644
--- a/Lua/Gen/PlayerPropertyConfigWrap.cs
+++ b/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)
diff --git a/Lua/Gen/UIHelperWrap.cs b/Lua/Gen/UIHelperWrap.cs
index 90afdfe..64a6f9a 100644
--- a/Lua/Gen/UIHelperWrap.cs
+++ b/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);
- }
}
diff --git a/System/Role/PropertyBehaviour.cs b/System/Role/PropertyBehaviour.cs
index 448aea1..c0faa01 100644
--- a/System/Role/PropertyBehaviour.cs
+++ b/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)
diff --git a/System/Role/ReikiQualityCell.cs b/System/Role/ReikiQualityCell.cs
index dad8597..6a1fe87 100644
--- a/System/Role/ReikiQualityCell.cs
+++ b/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);
}
}
}
diff --git a/System/Role/RolePropertyBehaviour.cs b/System/Role/RolePropertyBehaviour.cs
index ed22e46..ddeffb1 100644
--- a/System/Role/RolePropertyBehaviour.cs
+++ b/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);
}
}
}
diff --git a/System/Rune/RuneModel.cs b/System/Rune/RuneModel.cs
index 78df674..e7ac1a0 100644
--- a/System/Rune/RuneModel.cs
+++ b/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)
{
diff --git a/Utility/UIHelper.cs b/Utility/UIHelper.cs
index 46a3787..04fec59 100644
--- a/Utility/UIHelper.cs
+++ b/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)
--
Gitblit v1.8.0