From c55aae571592b66c4f8159feaa56bbe8f57f7857 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期六, 16 三月 2019 17:55:11 +0800
Subject: [PATCH] 3335 整理代码
---
Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs b/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
index 9687511..224f5de 100644
--- a/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
+++ b/Core/GameEngine/Model/TelPartialConfig/PlayerPropertyConfig.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Text.RegularExpressions;
public partial class PlayerPropertyConfig : IConfigPostProcess
{
@@ -28,42 +29,70 @@
return list;
}
- public static string GetPropertyDescription(int propertyId, int value)
+
+ public static string GetFullDescription(Int2 property)
{
- return GetPropertyDescription(propertyId, value, 1, false);
+ return GetFullDescription(property.x, property.y);
}
- public static string GetPropertyDescription(int propertyId, int value, int decimalCount, bool largeValue)
+ public static string GetFullDescription(int id, int value)
{
- var config = Get(propertyId);
+ var config = Get(id);
if (config == null)
{
return string.Empty;
}
- float _result = 0f;
+ if (config.Name.Contains("%s"))
+ {
+ return Regex.Replace(config.Name, "%s", value.ToString());
+ }
+ else
+ {
+ return string.Format("{0} +{1}", config.Name, GetValueDescription(id, value));
+ }
+ }
+ public static string GetValueDescription(Int2 property)
+ {
+ return GetValueDescription(property.x, property.y);
+ }
+
+ public static string GetValueDescription(int id, int value)
+ {
+ return GetValueDescription(id, value, 1, false);
+ }
+
+ public static string GetValueDescription(int id, int value, int decimalCount, bool largeValue)
+ {
+ var config = Get(id);
+ if (config == null)
+ {
+ return string.Empty;
+ }
+
+ var result = 0f;
if (config.ISPercentage == 0)
{
- _result = value;
+ result = value;
}
else if (config.ISPercentage == 1)
{
- _result = (float)Math.Round(value / 100f, decimalCount);
+ result = (float)Math.Round(value / 100f, decimalCount);
}
else if (config.ISPercentage == 2)
{
- _result = (float)Math.Round(value / 100f, decimalCount);
+ result = (float)Math.Round(value / 100f, decimalCount);
}
var label = string.Empty;
if (largeValue)
{
- label = UIHelper.ReplaceLargeNum(_result);
+ label = UIHelper.ReplaceLargeNum(result);
}
else
{
- label = _result.ToString();
+ label = result.ToString();
}
return config.ISPercentage == 1 ? (label + "%") : label;
--
Gitblit v1.8.0