少年修仙传客户端代码仓库
client_Wu Xijin
2018-08-14 99a3f198578f79b48bca1821554fb4b76270cd27
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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>>>>();
        static Dictionary<int, List<ItemCompoundConfig>> ticketComposeDict = new 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);
                    }
                }
 
            }
 
            if (firstType == (int)ComposeFuncType.Ticket)
            {
                var makeItemArray = ConfigParse.GetMultipleStr<int>(makeID);
                for (int i = 0; i < makeItemArray.Length; i++)
                {
                    List<ItemCompoundConfig> list = null;
                    if (!ticketComposeDict.TryGetValue(makeItemArray[i], out list))
                    {
                        list = new List<ItemCompoundConfig>();
                        ticketComposeDict.Add(makeItemArray[i], list);
                    }
                    list.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;
        }
 
        public static bool TryGetTicketCompose(int _ticketId, out List<ItemCompoundConfig> list)
        {
            return ticketComposeDict.TryGetValue(_ticketId, out list);
        }
 
    }
}