少年修仙传客户端代码仓库
leonard Wu
2018-08-02 a38909a99dd4108c110611a3575122fe77915a99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System.Collections.Generic;
using System.Text;
namespace TableConfig
{
 
    public partial class ItemCompoundConfig : ConfigBase, IConfigPostProcess
    {
        private static Dictionary<int, Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>>> allComposeModelDict = new Dictionary<int, Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>>>();
 
        public void OnConfigParseCompleted()
        {
            if (!allComposeModelDict.ContainsKey(firstType))
            {
                Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> secondTypeDict = new Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>>();
                Dictionary<int, List<ItemCompoundConfig>> thirdTypeDict = new Dictionary<int, List<ItemCompoundConfig>>();
                List<ItemCompoundConfig> thirdModellist = new List<ItemCompoundConfig>();
                thirdModellist.Add(this);
                thirdTypeDict.Add(thirdType, thirdModellist);
                secondTypeDict.Add(secondType, thirdTypeDict);
                allComposeModelDict.Add(firstType, secondTypeDict);
            }
            else
            {
                if (!allComposeModelDict[firstType].ContainsKey(secondType))
                {
                    Dictionary<int, List<ItemCompoundConfig>> thirdTypeDict = new Dictionary<int, List<ItemCompoundConfig>>();
                    List<ItemCompoundConfig> thirdModellist = new List<ItemCompoundConfig>();
                    thirdModellist.Add(this);
                    thirdTypeDict.Add(thirdType, thirdModellist);
                    allComposeModelDict[firstType].Add(secondType, thirdTypeDict);
                }
                else
                {
                    if (!allComposeModelDict[firstType][secondType].ContainsKey(thirdType))
                    {
                        List<ItemCompoundConfig> thirdModellist = new List<ItemCompoundConfig>();
                        thirdModellist.Add(this);
                        allComposeModelDict[firstType][secondType].Add(thirdType, thirdModellist);
                    }
                    else
                    {
                        allComposeModelDict[firstType][secondType][thirdType].Add(this);
                    }
                }
 
            }
        }
 
        /// <summary>
        /// 得到第一合成类型的数据
        /// </summary>
        /// <param name="firstType"></param>
        /// <returns></returns>
        public static Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> GetFirstComposeTypeDict(int firstType)
        {
            Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> composeTypeDict = new Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>>();
            if (allComposeModelDict.ContainsKey(firstType))
            {
                foreach (var secondType in allComposeModelDict[firstType].Keys)
                {
                    Dictionary<int, List<ItemCompoundConfig>> thirdTypeDict = allComposeModelDict[firstType][secondType];
                    foreach (var thirdType in thirdTypeDict.Keys)
                    {
                        for (int i = 0; i < thirdTypeDict[thirdType].Count; i++)
                        {
                            ItemCompoundConfig compoundConfig = thirdTypeDict[thirdType][i];
                            if (compoundConfig.levelNeed <= PlayerDatas.Instance.baseData.LV)
                            {
                                if (!composeTypeDict.ContainsKey(secondType))
                                {
                                    Dictionary<int, List<ItemCompoundConfig>> tempThirdTypeDict = new Dictionary<int, List<ItemCompoundConfig>>();
                                    List<ItemCompoundConfig> configlist = new List<ItemCompoundConfig>();
                                    configlist.Add(compoundConfig);
                                    tempThirdTypeDict.Add(thirdType, configlist);
                                    composeTypeDict.Add(secondType, tempThirdTypeDict);
                                }
                                else
                                {
                                    if (!composeTypeDict[secondType].ContainsKey(thirdType))
                                    {
                                        List<ItemCompoundConfig> configlist = new List<ItemCompoundConfig>();
                                        configlist.Add(compoundConfig);
                                        composeTypeDict[secondType].Add(thirdType, configlist);
                                    }
                                    else
                                    {
                                        composeTypeDict[secondType][thirdType].Add(compoundConfig);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return composeTypeDict;
        }
 
        public static Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> GetAllFirstComposeTypeDict(int firstType)
        {
            if (allComposeModelDict.ContainsKey(firstType))
            {
                return allComposeModelDict[firstType];
            }
 
            return null;
        }
 
    }
}