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>>();
|
static Dictionary<int, Dictionary<DisplayItemArray, int[]>> displayItemDict = new Dictionary<int, Dictionary<DisplayItemArray, int[]>>();
|
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);
|
}
|
}
|
|
}
|
|
int[] makeIDs = ConfigParse.GetMultipleStr<int>(makeID);
|
int[] unfixedItemIDs = ConfigParse.GetMultipleStr<int>(unfixedItemID);
|
int[] fixedItemIDs = ConfigParse.GetMultipleStr<int>(itemID);
|
int[] fixedItemCounts = ConfigParse.GetMultipleStr<int>(itemCount);
|
int[] unfixedDisplay = ConfigParse.GetMultipleStr<int>(unfixedItemDisplay);
|
int[] fixedDisplay = ConfigParse.GetMultipleStr<int>(itemDisplay);
|
|
if (!displayItemDict.ContainsKey(id))
|
{
|
Dictionary<DisplayItemArray, int[]> arrayDict = new Dictionary<DisplayItemArray, int[]>();
|
arrayDict.Add(DisplayItemArray.MakeIds,makeIDs);
|
arrayDict.Add(DisplayItemArray.UnfixedIds,unfixedItemIDs);
|
arrayDict.Add(DisplayItemArray.UnfixedDisplay,unfixedDisplay);
|
arrayDict.Add(DisplayItemArray.FixedIds,fixedItemIDs);
|
arrayDict.Add(DisplayItemArray.FixedCounts, fixedItemCounts);
|
arrayDict.Add(DisplayItemArray.FixedDisplay,fixedDisplay);
|
displayItemDict.Add(id, arrayDict);
|
}
|
|
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 ItemCompoundConfig GetItemCompoundByType(int firstType,int secondType, int thirdType)
|
{
|
if(allComposeModelDict.ContainsKey(firstType))
|
{
|
if(allComposeModelDict[firstType].ContainsKey(secondType))
|
{
|
if(allComposeModelDict[firstType][secondType].ContainsKey(thirdType))
|
{
|
return allComposeModelDict[firstType][secondType][thirdType][0];
|
}
|
}
|
}
|
return null;
|
}
|
|
public static bool TryGetTicketCompose(int _ticketId, out List<ItemCompoundConfig> list)
|
{
|
return ticketComposeDict.TryGetValue(_ticketId, out list);
|
}
|
|
public static int[] GetDisplayArrayByType(int id,DisplayItemArray display)
|
{
|
int[] array = null;
|
if(displayItemDict.ContainsKey(id))
|
{
|
displayItemDict[id].TryGetValue(display,out array);
|
}
|
return array;
|
}
|
|
}
|
}
|
|