using System.Collections.Generic; using System.Text; namespace TableConfig { public partial class ItemCompoundConfig : ConfigBase, IConfigPostProcess { private static Dictionary>>> allComposeModelDict = new Dictionary>>>(); static Dictionary> ticketComposeDict = new Dictionary>(); public void OnConfigParseCompleted() { if (!allComposeModelDict.ContainsKey(firstType)) { Dictionary>> secondTypeDict = new Dictionary>>(); Dictionary> thirdTypeDict = new Dictionary>(); List thirdModellist = new List(); thirdModellist.Add(this); thirdTypeDict.Add(thirdType, thirdModellist); secondTypeDict.Add(secondType, thirdTypeDict); allComposeModelDict.Add(firstType, secondTypeDict); } else { if (!allComposeModelDict[firstType].ContainsKey(secondType)) { Dictionary> thirdTypeDict = new Dictionary>(); List thirdModellist = new List(); thirdModellist.Add(this); thirdTypeDict.Add(thirdType, thirdModellist); allComposeModelDict[firstType].Add(secondType, thirdTypeDict); } else { if (!allComposeModelDict[firstType][secondType].ContainsKey(thirdType)) { List thirdModellist = new List(); 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(makeID); for (int i = 0; i < makeItemArray.Length; i++) { List list = null; if (!ticketComposeDict.TryGetValue(makeItemArray[i], out list)) { list = new List(); ticketComposeDict.Add(makeItemArray[i], list); } list.Add(this); } } } /// /// 得到第一合成类型的数据 /// /// /// public static Dictionary>> GetFirstComposeTypeDict(int firstType) { Dictionary>> composeTypeDict = new Dictionary>>(); if (allComposeModelDict.ContainsKey(firstType)) { foreach (var secondType in allComposeModelDict[firstType].Keys) { Dictionary> 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> tempThirdTypeDict = new Dictionary>(); List configlist = new List(); configlist.Add(compoundConfig); tempThirdTypeDict.Add(thirdType, configlist); composeTypeDict.Add(secondType, tempThirdTypeDict); } else { if (!composeTypeDict[secondType].ContainsKey(thirdType)) { List configlist = new List(); configlist.Add(compoundConfig); composeTypeDict[secondType].Add(thirdType, configlist); } else { composeTypeDict[secondType][thirdType].Add(compoundConfig); } } } } } } } return composeTypeDict; } public static Dictionary>> GetAllFirstComposeTypeDict(int firstType) { if (allComposeModelDict.ContainsKey(firstType)) { return allComposeModelDict[firstType]; } return null; } public static bool TryGetTicketCompose(int _ticketId, out List list) { return ticketComposeDict.TryGetValue(_ticketId, out list); } } }