少年修仙传客户端代码仓库
Client_PangDeRong
2018-12-07 a19ca12bc631559d7c4c04f2b5caf0368be18178
5289 【前端】【1.3.100】预览时装备评分传奇属性部分计算优化
1个文件已修改
121 ■■■■■ 已修改文件
System/KnapSack/Logic/PackModelInterface.cs 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PackModelInterface.cs
@@ -130,38 +130,24 @@
                {
                    List<int> legendIdlist = new List<int>();
                    List<int> legendValuelist = new List<int>();
                    if (itemTipsModel.legendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
                    switch (itemConfig.EquipPlace)
                    {
                        foreach (var attrType in itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
                        {
                            switch (attrType)
                            {
                                case LegendAttrType.Pursuit:
                                    legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
                                    break;
                                case LegendAttrType.Fixed:
                                    legendIdlist.AddRange(itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
                                    break;
                            }
                        }
                    }
                    int i = 0;
                    for (i = 0; i < legendIdlist.Count; i++)
                    {
                        if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
                        {
                            if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
                            {
                                legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
                            }
                        }
                        else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
                        {
                            if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
                            {
                                legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
                            }
                        }
                        case 11:
                            CalculateWingsLegendAttr(itemConfig,out legendIdlist, out legendValuelist);
                            break;
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 9:
                        case 10:
                        case 12:
                            CalculateEquipLegendAttr(itemConfig,out legendIdlist,out legendValuelist);
                            break;
                    }
                    if (legendIdlist.Count == legendValuelist.Count)
@@ -190,6 +176,79 @@
          
        }
        private void CalculateEquipLegendAttr(ItemConfig itemConfig,out List<int> legendIdlist, out List<int> legendValuelist)
        {
            legendIdlist = new List<int>();
            legendValuelist = new List<int>();
            string attrCntKey = StringUtility.Contact(itemConfig.ItemColor, itemConfig.StarLevel);
            var attrIDDict = itemTipsModel.legendAttrIDPreviewDict;
            var attrCntDict = itemTipsModel.legendAttrCntPreviewDict;
            if (attrIDDict.ContainsKey(itemConfig.EquipPlace))
            {
                var attrTypeDict = itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace];
                foreach (var attrType in attrTypeDict.Keys)
                {
                    var attrIds = attrTypeDict[attrType];
                    int attrCnt = 0;
                    if (attrCntDict.ContainsKey(attrCntKey))
                    {
                        attrCnt = attrCntDict[attrCntKey][attrType];
                    }
                    for(int i = 0; i < attrIds.Count; i++)
                    {
                        if(attrCnt > i)
                        {
                            legendIdlist.Add(attrIds[i]);
                        }
                    }
                }
            }
            for (int i = 0; i < legendIdlist.Count; i++)
            {
                if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
                {
                    if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
                    {
                        legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
                    }
                }
                else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
                {
                    if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
                    {
                        legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
                    }
                }
            }
        }
        private void CalculateWingsLegendAttr(ItemConfig itemConfig,out List<int> legendIdlist, out List<int> legendValuelist)
        {
            legendIdlist = new List<int>();
            legendValuelist = new List<int>();
            var attrCntDict = itemTipsModel.wingsLegendAttrCntPreviewDict;
            var attrValueDict = itemTipsModel.wingsLegendAttrValuePreviewDict;
            int attrCnt = 0;
            if (attrCntDict.ContainsKey(itemConfig.LV))
            {
                attrCnt = attrCntDict[itemConfig.LV];
            }
            if (attrValueDict.ContainsKey(itemConfig.LV))
            {
                var  attrIdDict = attrValueDict[itemConfig.LV];
                foreach (var attrId in attrIdDict.Keys)
                {
                    if(legendIdlist.Count < attrCnt)
                    {
                        legendIdlist.Add(attrId);
                        legendValuelist.Add(attrIdDict[attrId][0]);
                    }
                }
            }
        }
        #region 预览定制属性逻辑处理
        public bool CheckIsCustomItem(ItemConfig itemConfig)
        {