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;
|
}
|
|
}
|
}
|