少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-21 1b471c7231aa13a69b86eb57e84a831608be5ea0
3335 物品相关类型重构
1个文件已修改
33 ■■■■ 已修改文件
System/KnapSack/Logic/ItemLegendPropertyUtility.cs 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemLegendPropertyUtility.cs
@@ -65,9 +65,14 @@
        }
        public bool HasPropertyType(int propertyId)
        {
            return equipLegendPropertyColors.ContainsKey(propertyId);
        }
        public LegendAttrType GetPropertyType(int propertyId)
        {
            if (equipLegendPropertyColors.ContainsKey(propertyId))
            if (HasPropertyType(propertyId))
            {
                return equipLegendPropertyColors[propertyId];
            }
@@ -106,16 +111,36 @@
    public class LegendPropertyCount
    {
        Dictionary<>
        Dictionary<int, StarLegendPropertyCount> qualityToStarLegendPropertyCounts = new Dictionary<int, StarLegendPropertyCount>();
        public LegendPropertyCount(string configId)
        {
            var config = FuncConfigConfig.Get(configId);
            var json = JsonMapper.ToObject(config.Numerical1);
            foreach (var key in json.Keys)
            {
                var quality = int.Parse(key);
                qualityToStarLegendPropertyCounts[quality] = new StarLegendPropertyCount(json[key]);
            }
        }
        class StarLegendPropertyCount
        {
            Dictionary<LegendAttrType, int> counts = new Dictionary<LegendAttrType, int>();
            Dictionary<int, Dictionary<LegendAttrType, int>> counts = new Dictionary<int, Dictionary<LegendAttrType, int>>();
            public StarLegendPropertyCount(JsonData json)
            {
                foreach (var key in json.Keys)
                {
                    var star = int.Parse(key);
                    var typeCounts = counts[star] = new Dictionary<LegendAttrType, int>();
                    var subJson = json[key];
                    foreach (var item in subJson.Keys)
                    {
                        var type = (LegendAttrType)(int.Parse(item));
                        typeCounts[type] = (int)subJson[item];
                    }
                }
            }
        }