少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-22 3a2d0e9910f0958c3bbba2325a7a63d7194dba90
3335 物品相关类型重构
2 文件已重命名
2个文件已修改
260 ■■■■■ 已修改文件
System/KnapSack/Logic/ItemTipsModel.cs 181 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/LegendPropertyUtility.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/LegendPropertyUtility.cs.meta 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PackModelInterface.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemTipsModel.cs
@@ -17,11 +17,6 @@
        Dictionary<int, Dictionary<int, string>> wingsLegendAttrColorDict { get; set; }
        public Dictionary<string, Dictionary<LegendAttrType, int>> legendAttrCntPreviewDict { get; private set; } // key 品质+星级  value 属性条目数
        public Dictionary<int, Dictionary<LegendAttrType, List<int>>> legendAttrIDPreviewDict { get; private set; } // key 装备位 value 属性类型,属性ID
        public Dictionary<int, Dictionary<int, int>> legendAttrColorValuePreviewDict { get; private set; } // key 属性ID value 装备品质,属性数值
        public Dictionary<int, Dictionary<int, int>> legendAttrLvValuePreviewDict { get; private set; } // key 属性ID value 装备阶级,属性数值
        public Dictionary<int, int> wingsLegendAttrCntPreviewDict { get; private set; } //key 阶数 value属性数
        public Dictionary<int, Dictionary<int, List<int>>> wingsLegendAttrValuePreviewDict { get; private set; } //key 阶数 value 属性ID 属性数值
        public Dictionary<int, Dictionary<LegendAttrType, List<int>>> dogzLegendAttrIDPreviewDict { get; private set; } // key 装备位 value 属性类型,属性ID
@@ -127,26 +122,6 @@
                }
            }
            FuncConfigConfig legendAttrCountPreview = FuncConfigConfig.Get("LegendAttrCountPreview");
            JsonData legendAttrCntData = JsonMapper.ToObject(legendAttrCountPreview.Numerical1);
            legendAttrCntPreviewDict = new Dictionary<string, Dictionary<LegendAttrType, int>>();
            foreach (var color in legendAttrCntData.Keys)
            {
                foreach (var star in legendAttrCntData[color].Keys)
                {
                    Dictionary<LegendAttrType, int> legendCntDic = new Dictionary<LegendAttrType, int>();
                    legendAttrCntPreviewDict.Add(StringUtility.Contact(color, star), legendCntDic);
                    if (legendAttrCntData[color][star].IsArray)
                    {
                        int i = 0;
                        for (i = 0; i < legendAttrCntData[color][star].Count; i++)
                        {
                            legendCntDic.Add((LegendAttrType)i, int.Parse(legendAttrCntData[color][star][i].ToString()));
                        }
                    }
                }
            }
            FuncConfigConfig dogzlegendAttrCountPreview = FuncConfigConfig.Get("DogzLegendAttrCountPreview");
            JsonData dogzlegendAttrCntData = JsonMapper.ToObject(dogzlegendAttrCountPreview.Numerical1);
            dogzLegendAttrCntPreviewDict = new Dictionary<string, Dictionary<LegendAttrType, int>>();
@@ -162,32 +137,6 @@
                        for (i = 0; i < dogzlegendAttrCntData[color][star].Count; i++)
                        {
                            legendCntDic.Add((LegendAttrType)i, int.Parse(dogzlegendAttrCntData[color][star][i].ToString()));
                        }
                    }
                }
            }
            FuncConfigConfig legendAttrRulePreview = FuncConfigConfig.Get("LegendAttrRulePreview");
            JsonData legendAttrRuleData = JsonMapper.ToObject(legendAttrRulePreview.Numerical1);
            legendAttrIDPreviewDict = new Dictionary<int, Dictionary<LegendAttrType, List<int>>>();
            foreach (var itemPlace in legendAttrRuleData.Keys)
            {
                Dictionary<LegendAttrType, List<int>> legendIdDic = new Dictionary<LegendAttrType, List<int>>();
                legendAttrIDPreviewDict.Add(int.Parse(itemPlace.ToString()), legendIdDic);
                if (legendAttrRuleData[itemPlace].IsArray)
                {
                    int i = 0;
                    for (i = 0; i < legendAttrRuleData[itemPlace].Count; i++)
                    {
                        if (legendAttrRuleData[itemPlace][i].IsArray)
                        {
                            List<int> attrIdlist = new List<int>();
                            legendIdDic.Add((LegendAttrType)i, attrIdlist);
                            int j = 0;
                            for (j = 0; j < legendAttrRuleData[itemPlace][i].Count; j++)
                            {
                                attrIdlist.Add(int.Parse(legendAttrRuleData[itemPlace][i][j].ToString()));
                            }
                        }
                    }
                }
@@ -219,26 +168,6 @@
                }
            }
            FuncConfigConfig legendAttrColorValuePreview = FuncConfigConfig.Get("LegendAttrValueByColorPreview");
            JsonData legendAttrColorData = JsonMapper.ToObject(legendAttrColorValuePreview.Numerical1);
            legendAttrColorValuePreviewDict = new Dictionary<int, Dictionary<int, int>>();
            foreach (var attrID in legendAttrColorData.Keys)
            {
                Dictionary<int, int> legendValueDic = new Dictionary<int, int>();
                legendAttrColorValuePreviewDict.Add(int.Parse(attrID.ToString()), legendValueDic);
                if (legendAttrColorData[attrID].IsArray)
                {
                    int i = 0;
                    for (i = 0; i < legendAttrColorData[attrID].Count; i++)
                    {
                        if (legendAttrColorData[attrID][i].IsArray)
                        {
                            legendValueDic.Add(int.Parse(legendAttrColorData[attrID][i][0].ToString()), int.Parse(legendAttrColorData[attrID][i][1].ToString()));
                        }
                    }
                }
            }
            FuncConfigConfig dogzlegendAttrColorValuePreview = FuncConfigConfig.Get("DogzLegendAttrValueByColorPreview");
            JsonData dogzlegendAttrColorData = JsonMapper.ToObject(dogzlegendAttrColorValuePreview.Numerical1);
            dogzLegendAttrColorValuePreviewDict = new Dictionary<int, Dictionary<int, int>>();
@@ -254,26 +183,6 @@
                        if (dogzlegendAttrColorData[attrID][i].IsArray)
                        {
                            legendValueDic.Add(int.Parse(dogzlegendAttrColorData[attrID][i][0].ToString()), int.Parse(dogzlegendAttrColorData[attrID][i][1].ToString()));
                        }
                    }
                }
            }
            FuncConfigConfig legendAttrLvValuePreview = FuncConfigConfig.Get("LegendAttrValueByClassLVPreview");
            JsonData legendAttrLvData = JsonMapper.ToObject(legendAttrLvValuePreview.Numerical1);
            legendAttrLvValuePreviewDict = new Dictionary<int, Dictionary<int, int>>();
            foreach (var attrID in legendAttrLvData.Keys)
            {
                Dictionary<int, int> legendValueDic = new Dictionary<int, int>();
                legendAttrLvValuePreviewDict.Add(int.Parse(attrID.ToString()), legendValueDic);
                if (legendAttrLvData[attrID].IsArray)
                {
                    int i = 0;
                    for (i = 0; i < legendAttrLvData[attrID].Count; i++)
                    {
                        if (legendAttrLvData[attrID][i].IsArray)
                        {
                            legendValueDic.Add(int.Parse(legendAttrLvData[attrID][i][0].ToString()), int.Parse(legendAttrLvData[attrID][i][1].ToString()));
                        }
                    }
                }
@@ -315,7 +224,6 @@
                    }
                }
            }
            guardDesDict = new Dictionary<int, List<string>>();
            FuncConfigConfig guardDesFunc = FuncConfigConfig.Get("GuardianTips");
@@ -1591,7 +1499,7 @@
            {
                var quality = attrData.itemConfig.ItemColor;
                var starLevel = attrData.itemConfig.StarLevel;
                var count = ItemLegendPropertyUtility.GetEquipPropertyCount(quality, starLevel);
                var count = LegendPropertyUtility.GetEquipPropertyCount(quality, starLevel);
                if (starLevel > 2)
                {
                    s = Language.Get("LegendAttPreview_MustTitle", count);
@@ -1660,28 +1568,28 @@
        public string GetWingsLegendAttrCntPreview(ItemAttrData attrData)
        {
            string s = "";
            var description = "";
            if (attrData.isCustom)
            {
                s = Language.Get("LegendAttPreview_MustTitle", attrData.legendDataDict.Count);
                description = Language.Get("LegendAttPreview_MustTitle", attrData.legendDataDict.Count);
            }
            else
            {
                if (wingsLegendAttrCntPreviewDict.ContainsKey(attrData.itemConfig.LV))
                int attrCnt = LegendPropertyUtility.GetWingPropertyCount(attrData.itemConfig.LV);
                if (attrCnt > 0)
                {
                    int attrCnt = wingsLegendAttrCntPreviewDict[attrData.itemConfig.LV];
                    if (attrCnt > 1)
                    {
                        s = Language.Get("LegendAttPreview_MustTitle", attrCnt);
                        description = Language.Get("LegendAttPreview_MustTitle", attrCnt);
                    }
                    else
                    {
                        s = Language.Get("LegendAttPreview_MightTitle", attrCnt);
                        description = Language.Get("LegendAttPreview_MightTitle", attrCnt);
                    }
                }
            }
            return s;
            return description;
        }
        //即将丢弃
@@ -1799,29 +1707,26 @@
                            {
                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId])));
                            }
                            else if (wingsLegendAttrCntPreviewDict.ContainsKey(itemConfig.LV))
                            else
                            {
                                int minValue = 0;
                                int maxValue = 0;
                                if (wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
                                var count = LegendPropertyUtility.GetWingPropertyCount(itemConfig.LV);
                                if (count > 0)
                                {
                                    if (wingsLegendAttrValuePreviewDict[itemConfig.LV].ContainsKey(attrId))
                                    int minValue = LegendPropertyUtility.GetWingPropertyMinValue(itemConfig.LV, attrId);
                                    int maxValue = LegendPropertyUtility.GetWingPropertyMaxValue(itemConfig.LV, attrId);
                                    var minDescription = GetProValueTypeStr(playerProModel, minValue);
                                    var maxDescription = GetProValueTypeStr(playerProModel, maxValue);
                                    var description = StringUtility.Contact("[", minDescription, "~", maxDescription, "]");
                                    if (count > 1)
                                    {
                                        List<int> attrValuelist = wingsLegendAttrValuePreviewDict[itemConfig.LV][attrId];
                                        minValue = attrValuelist[0];
                                        maxValue = attrValuelist[attrValuelist.Count - 1];
                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", description));
                                    }
                                    else
                                    {
                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", description));
                                    }
                                }
                                if (wingsLegendAttrCntPreviewDict[itemConfig.LV] > 1)
                                {
                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", StringUtility.Contact("[", GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]")));
                                }
                                else
                                {
                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", StringUtility.Contact("[", GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]")));
                                }
                            }
                        }
                    }
@@ -1852,26 +1757,24 @@
                            {
                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId]));
                            }
                            else if (wingsLegendAttrCntPreviewDict.ContainsKey(itemConfig.LV))
                            else
                            {
                                int minValue = 0;
                                int maxValue = 0;
                                if (wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
                                var count = LegendPropertyUtility.GetWingPropertyCount(itemConfig.LV);
                                if (count > 0)
                                {
                                    if (wingsLegendAttrValuePreviewDict[itemConfig.LV].ContainsKey(attrId))
                                    int minValue = LegendPropertyUtility.GetWingPropertyMinValue(itemConfig.LV, attrId);
                                    int maxValue = LegendPropertyUtility.GetWingPropertyMaxValue(itemConfig.LV, attrId);
                                    var minDescription = GetProValueTypeStr(playerProModel, minValue);
                                    var maxDescription = GetProValueTypeStr(playerProModel, maxValue);
                                    var description = StringUtility.Contact("[+", minDescription, "~", maxDescription, "]");
                                    if (count > 1)
                                    {
                                        List<int> attrValuelist = wingsLegendAttrValuePreviewDict[itemConfig.LV][attrId];
                                        minValue = attrValuelist[0];
                                        maxValue = attrValuelist[attrValuelist.Count - 1];
                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, description);
                                    }
                                }
                                if (wingsLegendAttrCntPreviewDict[itemConfig.LV] > 1)
                                {
                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "[+", StringUtility.Contact(GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]"));
                                }
                                else
                                {
                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, "[+", StringUtility.Contact(GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]"));
                                    else
                                    {
                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, description);
                                    }
                                }
                            }
@@ -1997,7 +1900,7 @@
        private int GetLegendType(int id)
        {
            return (int)ItemLegendPropertyUtility.GetEquipPropertyType(id);
            return (int)LegendPropertyUtility.GetEquipPropertyType(id);
        }
        private int GetDogzLegendType(int id)
@@ -3116,15 +3019,15 @@
            values = new List<int>();
            var equipPlace = itemConfig.EquipPlace;
            if (ItemLegendPropertyUtility.HasEquipPlace(equipPlace))
            if (LegendPropertyUtility.HasEquipPlace(equipPlace))
            {
                ids.AddRange(ItemLegendPropertyUtility.GetEquipPlaceProperties(equipPlace));
                ids.AddRange(LegendPropertyUtility.GetEquipPlaceProperties(equipPlace));
            }
            for (var i = ids.Count - 1; i >= 0; i--)
            {
                var propertyId = ids[i];
                if (ItemLegendPropertyUtility.GetEquipPropertyType(propertyId) == LegendAttrType.Normal)
                if (LegendPropertyUtility.GetEquipPropertyType(propertyId) == LegendAttrType.Normal)
                {
                    ids.RemoveAt(i);
                }
@@ -3133,14 +3036,14 @@
            for (var i = 0; i < ids.Count; i++)
            {
                var propertyId = ids[i];
                var qualityPropertyValue = ItemLegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, itemConfig.ItemColor);
                var qualityPropertyValue = LegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, itemConfig.ItemColor);
                if (qualityPropertyValue != 0)
                {
                    values.Add(qualityPropertyValue);
                }
                else
                {
                    var levelPropertyValue = ItemLegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, itemConfig.LV);
                    var levelPropertyValue = LegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, itemConfig.LV);
                    if (levelPropertyValue != 0)
                    {
                        values.Add(levelPropertyValue);
System/KnapSack/Logic/LegendPropertyUtility.cs
File was renamed from System/KnapSack/Logic/ItemLegendPropertyUtility.cs
@@ -3,7 +3,7 @@
using UnityEngine;
using LitJson;
public class ItemLegendPropertyUtility
public class LegendPropertyUtility
{
    static PropertyColor propertyColor;
    static PropertyMap equipPropertyMap;
@@ -64,6 +64,11 @@
    }
    public static List<int> GetEquipPlaceProperties(int place)
    {
        return equipPropertyMap.GetProperties(place);
    }
    public static List<int> GetEquipPlaceProperties(int place, LegendAttrType type)
    {
        return equipPropertyMap.GetProperties(place);
    }
@@ -197,7 +202,7 @@
    public class PropertyMap
    {
        Dictionary<int, LegendAttrType> propertyTypes = new Dictionary<int, LegendAttrType>();
        // key 装备位 value 属性ID,属性类型
        // key 装备位 value 属性ID
        Dictionary<int, List<int>> placeToProperties = new Dictionary<int, List<int>>();
        public PropertyMap(string typeConfig, string placeConfig)
@@ -265,6 +270,27 @@
            }
        }
        public List<int> GetProperties(int place, LegendAttrType type)
        {
            if (!HasPlace(place))
            {
                return null;
            }
            var allProperties = placeToProperties[place];
            var properties = new List<int>();
            for (var i = 0; i < allProperties.Count; i++)
            {
                var propertyId = allProperties[i];
                if (propertyTypes[propertyId] == type)
                {
                    properties.Add(propertyId);
                }
            }
            return properties;
        }
    }
    public class PropertyCount
System/KnapSack/Logic/LegendPropertyUtility.cs.meta
System/KnapSack/Logic/PackModelInterface.cs
@@ -257,29 +257,17 @@
        {
            var config = ItemConfig.Get(itemId);
            var legendIdlist = new List<int>();
            string attrCntKey = StringUtility.Contact(config.ItemColor, config.StarLevel);
            var attrIDDict = itemTipsModel.legendAttrIDPreviewDict;
            var attrCntDict = itemTipsModel.legendAttrCntPreviewDict;
            if (attrIDDict.ContainsKey(config.EquipPlace))
            if (LegendPropertyUtility.HasEquipPlace(config.EquipPlace))
            {
                var attrTypeDict = itemTipsModel.legendAttrIDPreviewDict[config.EquipPlace];
                foreach (var attrType in attrTypeDict.Keys)
                for (var i = 0; i < 3; i++)
                {
                    var attrIds = attrTypeDict[attrType];
                    int attrCnt = 0;
                    if (attrCntDict.ContainsKey(attrCntKey))
                    var type = (LegendAttrType)i;
                    var count = LegendPropertyUtility.GetEquipPropertyCount(config.ItemColor, config.StarLevel, type);
                    if (count > 0)
                    {
                        attrCnt = attrCntDict[attrCntKey][attrType];
                    }
                    for (int i = 0; i < attrIds.Count; i++)
                    {
                        if (attrCnt > i)
                        {
                            legendIdlist.Add(attrIds[i]);
                        }
                        var propertyIds = LegendPropertyUtility.GetEquipPlaceProperties(config.EquipPlace, type);
                        legendIdlist.AddRange(propertyIds.GetRange(0, count));
                    }
                }
            }
@@ -288,18 +276,17 @@
            for (int i = 0; i < legendIdlist.Count; i++)
            {
                var propertyId = legendIdlist[i];
                if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(propertyId))
                var qualityPropertyValue = LegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, config.ItemColor);
                if (qualityPropertyValue != 0)
                {
                    if (itemTipsModel.legendAttrColorValuePreviewDict[propertyId].ContainsKey(config.ItemColor))
                    {
                        properties[propertyId] = itemTipsModel.legendAttrColorValuePreviewDict[propertyId][config.ItemColor];
                    }
                    properties[propertyId] = qualityPropertyValue;
                }
                else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(propertyId))
                else
                {
                    if (itemTipsModel.legendAttrLvValuePreviewDict[propertyId].ContainsKey(config.LV))
                    var levelPropertyValue = LegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, config.LV);
                    if (levelPropertyValue != 0)
                    {
                        properties[propertyId] = itemTipsModel.legendAttrLvValuePreviewDict[propertyId][config.LV];
                        properties[propertyId] = levelPropertyValue;
                    }
                }
            }
@@ -310,13 +297,7 @@
        private Dictionary<int, int> GetWingsLegendProperties(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            var attrCntDict = itemTipsModel.wingsLegendAttrCntPreviewDict;
            int attrCnt = 0;
            if (attrCntDict.ContainsKey(config.LV))
            {
                attrCnt = attrCntDict[config.LV];
            }
            int attrCnt = LegendPropertyUtility.GetWingPropertyCount(config.LV);
            var attrValueDict = itemTipsModel.wingsLegendAttrValuePreviewDict;
            var properties = new Dictionary<int, int>();
            if (attrValueDict.ContainsKey(config.LV))