少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-23 7dc0f7e642075c828b5b7a94b7317b4fcf87e913
3335 物品相关类型重构
4个文件已修改
226 ■■■■ 已修改文件
Lua/Gen/SnxxzUIPackModelInterfaceWrap.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/ItemTipsModel.cs 193 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PackModelInterface.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/PlayerPackModels.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/SnxxzUIPackModelInterfaceWrap.cs
@@ -616,10 +616,6 @@
                
                {
                    
                        System.Collections.Generic.List<string> gen_ret = gen_to_be_invoked.GetItemEffectTimelist(  );
                        translator.Push(L, gen_ret);
                    
                    return 1;
                }
@@ -1271,7 +1267,6 @@
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
                Snxxz.UI.PackModelInterface gen_to_be_invoked = (Snxxz.UI.PackModelInterface)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.itemModelDict);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
@@ -1316,7 +1311,6 @@
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
                Snxxz.UI.PackModelInterface gen_to_be_invoked = (Snxxz.UI.PackModelInterface)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.itemModelDict = (System.Collections.Generic.Dictionary<int, System.Collections.Generic.Dictionary<int, Snxxz.UI.ItemModel>>)translator.GetObject(L, 2, typeof(System.Collections.Generic.Dictionary<int, System.Collections.Generic.Dictionary<int, Snxxz.UI.ItemModel>>));
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
System/KnapSack/Logic/ItemTipsModel.cs
@@ -14,14 +14,6 @@
    {
        FuncConfigConfig exhaustedFunc;
        Dictionary<int, Dictionary<int, string>> wingsLegendAttrColorDict { get; set; }
        public Dictionary<int, Dictionary<LegendAttrType, List<int>>> dogzLegendAttrIDPreviewDict { get; private set; } // key 装备位 value 属性类型,属性ID
        public Dictionary<int, Dictionary<int, int>> dogzLegendAttrColorValuePreviewDict { get; private set; } // key 属性ID value 装备品质,属性数值
        Dictionary<string, Dictionary<LegendAttrType, int>> dogzLegendAttrCntPreviewDict { get; set; } // key 品质+星级  value 属性条目数
        Dictionary<int, List<int>> dogzLegendAttrTypeDict { get; set; }
        public Dictionary<int, List<string>> guardDesDict { get; private set; }
        public Dictionary<int, PetInfoConfig> unlockPetDict { get; private set; }
@@ -87,104 +79,6 @@
            FuncConfigConfig EquipOutWordID = FuncConfigConfig.Get("EquipOutWordID");
            PeerlessEquipIds = ConfigParse.GetMultipleStr<int>(EquipOutWordID.Numerical1);
            FuncConfigConfig legendAttrColor = FuncConfigConfig.Get("LegendAttrColor");
            wingsLegendAttrColorDict = new Dictionary<int, Dictionary<int, string>>();
            if (legendAttrColor != null)
            {
                JsonData jsonData2 = JsonMapper.ToObject(legendAttrColor.Numerical2);
                foreach (var key in jsonData2.Keys)
                {
                    Dictionary<int, string> colorDict = new Dictionary<int, string>();
                    wingsLegendAttrColorDict.Add(int.Parse(key), colorDict);
                    foreach (var key2 in jsonData2[key].Keys)
                    {
                        colorDict.Add(int.Parse(key2), jsonData2[key][key2][0].ToString());
                    }
                }
            }
            FuncConfigConfig dogzlegendAttrColor = FuncConfigConfig.Get("DogzLegendAttrColor");
            dogzLegendAttrTypeDict = new Dictionary<int, List<int>>();
            if (dogzlegendAttrColor != null)
            {
                JsonData jsonData = JsonMapper.ToObject(dogzlegendAttrColor.Numerical1);
                foreach (var key in jsonData.Keys)
                {
                    List<int> attrIDlist = new List<int>();
                    dogzLegendAttrTypeDict.Add(int.Parse(key), attrIDlist);
                    for (int i = 0; i < jsonData[key].Count; i++)
                    {
                        attrIDlist.Add((int)jsonData[key][i]);
                    }
                }
            }
            FuncConfigConfig dogzlegendAttrCountPreview = FuncConfigConfig.Get("DogzLegendAttrCountPreview");
            JsonData dogzlegendAttrCntData = JsonMapper.ToObject(dogzlegendAttrCountPreview.Numerical1);
            dogzLegendAttrCntPreviewDict = new Dictionary<string, Dictionary<LegendAttrType, int>>();
            foreach (var color in dogzlegendAttrCntData.Keys)
            {
                foreach (var star in dogzlegendAttrCntData[color].Keys)
                {
                    Dictionary<LegendAttrType, int> legendCntDic = new Dictionary<LegendAttrType, int>();
                    dogzLegendAttrCntPreviewDict.Add(StringUtility.Contact(color, star), legendCntDic);
                    if (dogzlegendAttrCntData[color][star].IsArray)
                    {
                        int i = 0;
                        for (i = 0; i < dogzlegendAttrCntData[color][star].Count; i++)
                        {
                            legendCntDic.Add((LegendAttrType)i, int.Parse(dogzlegendAttrCntData[color][star][i].ToString()));
                        }
                    }
                }
            }
            FuncConfigConfig dogzlegendAttrRulePreview = FuncConfigConfig.Get("DogzLegendAttrRulePreview");
            JsonData dogzlegendAttrRuleData = JsonMapper.ToObject(dogzlegendAttrRulePreview.Numerical1);
            dogzLegendAttrIDPreviewDict = new Dictionary<int, Dictionary<LegendAttrType, List<int>>>();
            foreach (var itemPlace in dogzlegendAttrRuleData.Keys)
            {
                Dictionary<LegendAttrType, List<int>> legendIdDic = new Dictionary<LegendAttrType, List<int>>();
                dogzLegendAttrIDPreviewDict.Add(int.Parse(itemPlace.ToString()), legendIdDic);
                if (dogzlegendAttrRuleData[itemPlace].IsArray)
                {
                    int i = 0;
                    for (i = 0; i < dogzlegendAttrRuleData[itemPlace].Count; i++)
                    {
                        if (dogzlegendAttrRuleData[itemPlace][i].IsArray)
                        {
                            List<int> attrIdlist = new List<int>();
                            legendIdDic.Add((LegendAttrType)i, attrIdlist);
                            int j = 0;
                            for (j = 0; j < dogzlegendAttrRuleData[itemPlace][i].Count; j++)
                            {
                                attrIdlist.Add(int.Parse(dogzlegendAttrRuleData[itemPlace][i][j].ToString()));
                            }
                        }
                    }
                }
            }
            FuncConfigConfig dogzlegendAttrColorValuePreview = FuncConfigConfig.Get("DogzLegendAttrValueByColorPreview");
            JsonData dogzlegendAttrColorData = JsonMapper.ToObject(dogzlegendAttrColorValuePreview.Numerical1);
            dogzLegendAttrColorValuePreviewDict = new Dictionary<int, Dictionary<int, int>>();
            foreach (var attrID in dogzlegendAttrColorData.Keys)
            {
                Dictionary<int, int> legendValueDic = new Dictionary<int, int>();
                dogzLegendAttrColorValuePreviewDict.Add(int.Parse(attrID.ToString()), legendValueDic);
                if (dogzlegendAttrColorData[attrID].IsArray)
                {
                    int i = 0;
                    for (i = 0; i < dogzlegendAttrColorData[attrID].Count; i++)
                    {
                        if (dogzlegendAttrColorData[attrID][i].IsArray)
                        {
                            legendValueDic.Add(int.Parse(dogzlegendAttrColorData[attrID][i][0].ToString()), int.Parse(dogzlegendAttrColorData[attrID][i][1].ToString()));
                        }
                    }
                }
            }
            guardDesDict = new Dictionary<int, List<string>>();
            FuncConfigConfig guardDesFunc = FuncConfigConfig.Get("GuardianTips");
@@ -1493,34 +1387,19 @@
            }
            else
            {
                int attrCnt = 0;
                string attrCntKey = StringUtility.Contact(attrData.itemConfig.ItemColor, attrData.itemConfig.StarLevel);
                if (dogzLegendAttrCntPreviewDict.ContainsKey(attrCntKey))
                {
                    foreach (var key in dogzLegendAttrCntPreviewDict[attrCntKey].Keys)
                    {
                        switch (key)
                        {
                            case LegendAttrType.Normal:
                                attrCnt += dogzLegendAttrCntPreviewDict[attrCntKey][key];
                                break;
                            case LegendAttrType.Pursuit:
                                attrCnt += dogzLegendAttrCntPreviewDict[attrCntKey][key];
                                break;
                            case LegendAttrType.Fixed:
                                attrCnt += dogzLegendAttrCntPreviewDict[attrCntKey][key];
                                break;
                        }
                    }
                }
                var quality = attrData.itemConfig.ItemColor;
                var starLevel = attrData.itemConfig.StarLevel;
                var count = LegendPropertyUtility.GetDogzPropertyCount(quality, starLevel, LegendAttrType.Normal);
                count += LegendPropertyUtility.GetDogzPropertyCount(quality, starLevel, LegendAttrType.Pursuit);
                count += LegendPropertyUtility.GetDogzPropertyCount(quality, starLevel, LegendAttrType.Fixed);
                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);
                }
            }
@@ -1748,21 +1627,7 @@
                switch (itemConfig.EquipPlace)
                {
                    case 11:
                        foreach (var key in wingsLegendAttrColorDict.Keys)
                        {
                            if (key == attrId)
                            {
                                foreach (var key2 in wingsLegendAttrColorDict[key].Keys)
                                {
                                    if (attrDict[attrId] < key2)
                                    {
                                        s = string.Format("<color=#{0}>{1}</color>", wingsLegendAttrColorDict[key][key2], s);
                                        break;
                                    }
                                }
                                break;
                            }
                        }
                        s = string.Format("<color=#{0}>{1}</color>", LegendPropertyUtility.GetWingPropertyColor(attrId, attrDict[attrId]), s);
                        break;
                    case 1:
                    case 2:
@@ -1866,14 +1731,7 @@
        private int GetDogzLegendType(int id)
        {
            foreach (var key in dogzLegendAttrTypeDict.Keys)
            {
                if (dogzLegendAttrTypeDict[key].Contains(id))
                {
                    return key;
                }
            }
            return 0;
            return (int)LegendPropertyUtility.GetDogzPropertyType(id);
        }
        private string GetTextColorByLegendType(int type, string msg)
@@ -3020,32 +2878,29 @@
        {
            legendIdlist = new List<int>();
            legendValuelist = new List<int>();
            if (itemTipsModel.dogzLegendAttrIDPreviewDict.ContainsKey(itemConfig.EquipPlace))
            var place = itemConfig.EquipPlace;
            if (LegendPropertyUtility.HasDogzPlace(place))
            {
                foreach (var attrType in itemTipsModel.dogzLegendAttrIDPreviewDict[itemConfig.EquipPlace].Keys)
                var ids = LegendPropertyUtility.GetDogzPlaceProperties(place);
                for (var i = ids.Count - 1; i >= 0; i--)
                {
                    switch (attrType)
                    if (LegendPropertyUtility.GetDogzPropertyType(ids[i]) == LegendAttrType.Normal)
                    {
                        case LegendAttrType.Pursuit:
                            legendIdlist.AddRange(itemTipsModel.dogzLegendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
                            break;
                        case LegendAttrType.Fixed:
                            legendIdlist.AddRange(itemTipsModel.dogzLegendAttrIDPreviewDict[itemConfig.EquipPlace][attrType]);
                            break;
                        ids.RemoveAt(i);
                    }
                }
                legendIdlist.AddRange(ids);
            }
            int i = 0;
            for (i = 0; i < legendIdlist.Count; i++)
            for (var i = 0; i < legendIdlist.Count; i++)
            {
                if (itemTipsModel.dogzLegendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
                {
                    if (itemTipsModel.dogzLegendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
                    {
                        legendValuelist.Add(itemTipsModel.dogzLegendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
                    }
                }
                var propertyId = legendIdlist[i];
                var value = LegendPropertyUtility.GetDogzQualityPropertyValue(propertyId, itemConfig.ItemColor);
                legendValuelist.Add(value);
            }
        }
        private void SetJadeDynastyEquipLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
System/KnapSack/Logic/PackModelInterface.cs
@@ -76,9 +76,7 @@
        public void OnBeforePlayerDataInitialize()
        {
            isPackResetOk = true;
            itemModelDict.Clear();
            itemEffectCDDict.Clear();
            itemEffectTimelist.Clear();
            ClearSortedBetterEquip();
        }
        public override void UnInit()
@@ -968,7 +966,6 @@
        #region 物品处于CD中的逻辑处理
        private Dictionary<string, double> itemEffectCDDict = new Dictionary<string, double>(); //key 物品实例ID
        private List<string> itemEffectTimelist = new List<string>(); //key 物品实例ID
        /// <summary>
        /// 物品使用时间限制
@@ -980,7 +977,7 @@
            {
                time = 0;
            }
            itemEffectTimelist.Add(guid);
            ItemConfig itemConfig = ItemConfig.Get(itemID);
            if (time >= itemConfig.ExpireTime)
            {
@@ -998,11 +995,6 @@
            TimeSpan t = TimeUtility.ServerNow - getTime;
            DebugEx.Log("时间差:" + t.TotalSeconds);
            return t.TotalSeconds;
        }
        public List<string> GetItemEffectTimelist()
        {
            return itemEffectTimelist;
        }
        #endregion
@@ -1043,10 +1035,7 @@
        public bool IsEquip(ItemModel model)
        {
            if (model.config.EquipPlace != 0)
                return true;
            else
                return false;
            return model.config.EquipPlace != 0;
        }
        public void GetOneKeySellModel()
@@ -1416,7 +1405,13 @@
        #endregion
        #region 背包整理后好的同类型最好的装备
        public Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>();  // key1 装备位置索引 key2 背包位置索引
         Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>();  // key1 装备位置索引 key2 背包位置索引
        public void ClearSortedBetterEquip()
        {
            itemModelDict.Clear();
        }
        public void SetBagSortBetterEquipList(ItemModel itemModel)
        {
            if (itemModel == null || itemModel.packType != PackType.Item) return;
System/KnapSack/Logic/PlayerPackModels.cs
@@ -180,7 +180,7 @@
            if (isPlayBetterEquipEffect)
            {
                modelInterface.itemModelDict.Clear();
                modelInterface.ClearSortedBetterEquip();
            }
            for (int i = 0; i < packInfo.ItemCount; i++)
            {