| | |
| | | |
| | | public partial class PlayerPropertyConfig : ConfigBase<int, PlayerPropertyConfig> |
| | | { |
| | | private static Dictionary<int, List<PlayerPropertyConfig>> m_PropCfgs = new Dictionary<int, List<PlayerPropertyConfig>>(); |
| | | private static Dictionary<int, List<int>> outputDict = new Dictionary<int, List<int>>(); |
| | | |
| | | public static int[] baseAttrs = { 6, 7, 8 }; //攻防血 |
| | | public static int[] basePerAttrs = { 16, 17, 18 }; //攻防血 百分比 |
| | | protected override void OnConfigParseCompleted() |
| | | // 按显示类型分 |
| | | private static Dictionary<int, List<int>> m_PlayerPropertyDict = new Dictionary<int, List<int>>(); |
| | | public static Dictionary<int, List<int>> playerPropertyDict |
| | | { |
| | | List<PlayerPropertyConfig> list = null; |
| | | m_PropCfgs.TryGetValue(type, out list); |
| | | if (list != null) |
| | | get |
| | | { |
| | | list.Add(this); |
| | | } |
| | | else |
| | | { |
| | | list = new List<PlayerPropertyConfig>(); |
| | | list.Add(this); |
| | | m_PropCfgs.Add(type, list); |
| | | if (m_PlayerPropertyDict.IsNullOrEmpty()) |
| | | RefreshShowDict(); |
| | | return m_PlayerPropertyDict; |
| | | } |
| | | } |
| | | public static Dictionary<int, List<int>> GetShowDict() |
| | | |
| | | public static int[] inheritAttrs = playerPropertyDict[5].ToArray(); //攻防血 继承的百分比 |
| | | public static int[] basePerAttrs = playerPropertyDict[6].ToArray(); //攻防血 加成百分比 |
| | | |
| | | public const int baseType = 1; //基础属性 |
| | | public const int fightType = 2; //战斗属性 |
| | | public const int fightAntiType = 3; //战斗抗性 |
| | | public const int specialType = 4; //特殊属性 |
| | | private static Dictionary<int, List<int>> RefreshShowDict() |
| | | { |
| | | if (outputDict.IsNullOrEmpty()) |
| | | if (m_PlayerPropertyDict.IsNullOrEmpty()) |
| | | { |
| | | var keys = GetKeys(); |
| | | for (int i = 0; i < keys.Count; i++) |
| | |
| | | int showType = Get(id).showType; |
| | | if (showType == 0) //为0时不显示 |
| | | continue; |
| | | if (!outputDict.ContainsKey(showType)) |
| | | if (!m_PlayerPropertyDict.ContainsKey(showType)) |
| | | { |
| | | outputDict[showType] = new List<int> { id }; |
| | | m_PlayerPropertyDict[showType] = new List<int> { id }; |
| | | } |
| | | else |
| | | { |
| | | outputDict[showType].Add(id); |
| | | m_PlayerPropertyDict[showType].Add(id); |
| | | } |
| | | } |
| | | var outputList = outputDict.Keys.ToList(); |
| | | for (int i = 0; i < outputList.Count; i++) |
| | | foreach (var showType in m_PlayerPropertyDict.Keys) |
| | | { |
| | | int showType = outputList[i]; |
| | | outputDict[showType].Sort(cmp); |
| | | m_PlayerPropertyDict[showType].Sort(cmp); |
| | | } |
| | | } |
| | | return outputDict; |
| | | return m_PlayerPropertyDict; |
| | | } |
| | | |
| | | static int cmp(int id1, int id2) |
| | |
| | | return config1.showSequence.CompareTo(config2.showSequence); |
| | | } |
| | | |
| | | public static List<PlayerPropertyConfig> GetPropByType(int type) |
| | | { |
| | | List<PlayerPropertyConfig> list = null; |
| | | m_PropCfgs.TryGetValue(type, out list); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static string GetFullDescription(Int2 property) |