using System.Collections.Generic;
|
using System.Linq;
|
using UnityEngine;
|
|
public partial class MainLevelConfig : ConfigBase<int, MainLevelConfig>
|
{
|
static Dictionary<int, Dictionary<int, MainLevelConfig>> configDics = new Dictionary<int, Dictionary<int, MainLevelConfig>>();
|
|
protected override void OnConfigParseCompleted()
|
{
|
Dictionary<int, MainLevelConfig> tempDic = null;
|
if (!configDics.TryGetValue(ChapterID, out tempDic))
|
{
|
tempDic = new Dictionary<int, MainLevelConfig>();
|
configDics.Add(ChapterID, tempDic);
|
}
|
|
tempDic[LevelNum] = this;
|
}
|
|
public static MainLevelConfig GetMainLevelConfig(int chapterID, int LevelNum)
|
{
|
Dictionary<int, MainLevelConfig> tempDic = null;
|
if (!configDics.TryGetValue(chapterID, out tempDic))
|
{
|
return null;
|
}
|
MainLevelConfig config = null;
|
tempDic.TryGetValue(LevelNum, out config);
|
return config;
|
}
|
|
public static int GetwaveCount(MainLevelConfig config)
|
{
|
int[][] waveLineupLists = new int[][]
|
{
|
config.WaveLineupIDList1,
|
config.WaveLineupIDList2,
|
config.WaveLineupIDList3,
|
config.WaveLineupIDList4,
|
config.WaveLineupIDList5,
|
config.WaveLineupIDList6
|
};
|
|
// 统计非空数组的数量
|
return waveLineupLists.Count(list => list.Length > 0);
|
}
|
|
|
}
|