using System;
|
using System.Collections.Generic;
|
|
public partial class PlayerPropertyConfig : IConfigPostProcess
|
{
|
private static Dictionary<int, List<PlayerPropertyConfig>> m_PropCfgs = new Dictionary<int, List<PlayerPropertyConfig>>();
|
|
public void OnConfigParseCompleted()
|
{
|
List<PlayerPropertyConfig> list = null;
|
m_PropCfgs.TryGetValue(type, out list);
|
if (list != null)
|
{
|
list.Add(this);
|
}
|
else
|
{
|
list = new List<PlayerPropertyConfig>();
|
list.Add(this);
|
m_PropCfgs.Add(type, list);
|
}
|
}
|
|
public static List<PlayerPropertyConfig> GetPropByType(int type)
|
{
|
List<PlayerPropertyConfig> list = null;
|
m_PropCfgs.TryGetValue(type, out list);
|
return list;
|
}
|
|
public static string GetPropertyDescription(int propertyId, int value)
|
{
|
var config = Get(propertyId);
|
if (config == null)
|
{
|
return string.Empty;
|
}
|
|
if (config.ISPercentage == 0)
|
{
|
return value.ToString();
|
}
|
else if (config.ISPercentage == 1)
|
{
|
return (float)Math.Round(value / 100f, 1) + "%";
|
}
|
else if (config.ISPercentage == 2)
|
{
|
return ((float)Math.Round(value / 100f, 1)).ToString();
|
}
|
|
return string.Empty;
|
}
|
|
}
|