少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-22 5e7aff5a1977c734acb53e41582a891d07fdf69f
3335 物品相关类型重构
2个文件已修改
123 ■■■■■ 已修改文件
System/KnapSack/Logic/ItemLegendPropertyUtility.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemTipsModel.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemLegendPropertyUtility.cs
@@ -98,6 +98,13 @@
        return equipPropertyCount.GetCount(quality, star, type);
    }
    public static int GetEquipPropertyCount(int quality, int star)
    {
        return equipPropertyCount.GetCount(quality, star, LegendAttrType.Normal)
            + equipPropertyCount.GetCount(quality, star, LegendAttrType.Fixed)
            + equipPropertyCount.GetCount(quality, star, LegendAttrType.Fixed);
    }
    public static int GetDogzPropertyCount(int quality, int star, LegendAttrType type)
    {
        return dogzPropertyCount.GetCount(quality, star, type);
@@ -140,17 +147,6 @@
        public PropertyColor(string configId)
        {
            var config = FuncConfigConfig.Get(configId);
            var equipColorJsonData = JsonMapper.ToObject(config.Numerical1);
            foreach (var key in equipColorJsonData.Keys)
            {
                var keyToInt = int.Parse(key);
                for (int i = 0; i < equipColorJsonData[key].Count; i++)
                {
                    var propertyId = (int)equipColorJsonData[key][i];
                    equipLegendPropertyColors[propertyId] = (LegendAttrType)keyToInt;
                }
            }
            var wingColorJsonData = JsonMapper.ToObject(config.Numerical2);
            foreach (var key in wingColorJsonData.Keys)
@@ -261,7 +257,7 @@
        {
            if (HasPlace(place))
            {
                return new List<int>(placeToProperties[place].Keys);
                return placeToProperties[place];
            }
            else
            {
System/KnapSack/Logic/ItemTipsModel.cs
@@ -1589,34 +1589,16 @@
            }
            else
            {
                int attrCnt = 0;
                string attrCntKey = StringUtility.Contact(attrData.itemConfig.ItemColor, attrData.itemConfig.StarLevel);
                if (legendAttrCntPreviewDict.ContainsKey(attrCntKey))
                var quality = attrData.itemConfig.ItemColor;
                var starLevel = attrData.itemConfig.StarLevel;
                var count = ItemLegendPropertyUtility.GetEquipPropertyCount(quality, starLevel);
                if (starLevel > 2)
                {
                    foreach (var key in legendAttrCntPreviewDict[attrCntKey].Keys)
                    {
                        switch (key)
                        {
                            case LegendAttrType.Normal:
                                attrCnt += legendAttrCntPreviewDict[attrCntKey][key];
                                break;
                            case LegendAttrType.Pursuit:
                                attrCnt += legendAttrCntPreviewDict[attrCntKey][key];
                                break;
                            case LegendAttrType.Fixed:
                                attrCnt += legendAttrCntPreviewDict[attrCntKey][key];
                                break;
                        }
                    }
                }
                if (attrData.itemConfig.StarLevel > 2)
                {
                    s = Language.Get("LegendAttPreview_MustTitle", attrCnt);
                    s = Language.Get("LegendAttPreview_MustTitle", count);
                }
                else
                {
                    s = Language.Get("LegendAttPreview_MightTitle", attrCnt);
                    s = Language.Get("LegendAttPreview_MightTitle", count);
                }
            }
@@ -3111,66 +3093,57 @@
            this.extraInfos = extraInfos;
        }
        private void SetWingsLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
        private void SetWingsLegendAttrPreview(out List<int> ids, out List<int> values)
        {
            legendIdlist = new List<int>();
            legendValuelist = new List<int>();
            ids = new List<int>();
            values = new List<int>();
            if (itemTipsModel.wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
            {
                Dictionary<int, List<int>> attrIdDict = itemTipsModel.wingsLegendAttrValuePreviewDict[itemConfig.LV];
                foreach (var attrId in attrIdDict.Keys)
                {
                    legendIdlist.Add(attrId);
                    legendValuelist.Add(attrIdDict[attrId][0]);
                    ids.Add(attrId);
                    values.Add(attrIdDict[attrId][0]);
                }
            }
        }
        private void SetEquipLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
        private void SetEquipLegendAttrPreview(out List<int> ids, out List<int> values)
        {
            legendIdlist = new List<int>();
            legendValuelist = new List<int>();
            string attrCntKey = StringUtility.Contact(itemConfig.ItemColor, itemConfig.StarLevel);
            if (itemTipsModel.legendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
            {
                foreach (var attrType in itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
                {
                    int attrCnt = 0;
                    if (itemTipsModel.legendAttrCntPreviewDict.ContainsKey(attrCntKey))
                    {
                        attrCnt = itemTipsModel.legendAttrCntPreviewDict[attrCntKey][attrType];
                    }
                    if (attrCnt > 0)
                    {
                        switch (attrType)
                        {
                            case LegendAttrType.Pursuit:
                                legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
                                break;
                            case LegendAttrType.Fixed:
                                legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
                                break;
                        }
                    }
            ids = new List<int>();
            values = new List<int>();
            var equipPlace = itemConfig.EquipPlace;
            if (ItemLegendPropertyUtility.HasEquipPlace(equipPlace))
            {
                ids.AddRange(ItemLegendPropertyUtility.GetEquipPlaceProperties(equipPlace));
            }
            for (var i = ids.Count - 1; i >= 0; i--)
            {
                var propertyId = ids[i];
                if (ItemLegendPropertyUtility.GetEquipPropertyType(propertyId) == LegendAttrType.Normal)
                {
                    ids.RemoveAt(i);
                }
            }
            int i = 0;
            for (i = 0; i < legendIdlist.Count; i++)
            for (var i = 0; i < ids.Count; i++)
            {
                if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
                var propertyId = ids[i];
                var qualityPropertyValue = ItemLegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, itemConfig.ItemColor);
                if (qualityPropertyValue != 0)
                {
                    if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
                    {
                        legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
                    }
                    values.Add(qualityPropertyValue);
                }
                else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
                else
                {
                    if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
                    var levelPropertyValue = ItemLegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, itemConfig.LV);
                    if (levelPropertyValue != 0)
                    {
                        legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
                        values.Add(levelPropertyValue);
                    }
                }
            }