hch
11 小时以前 e86b479e72e15c9e99ea6352a40e473ca635fba3
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
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);
    }
 
    // 获取目标关卡的索引
    public static int GetToTargetLevelIndex(int targetLevel)
    {
        var levels = GetKeys();
        levels.Sort();
        return levels.IndexOf(targetLevel);
 
    }
 
    public static int GetPassedLevel()
    {
        var keys = GetKeys();
        keys.Sort();
        var curLevel = PlayerDatas.Instance.baseData.ExAttr1 / 100;
        var curLevelIndex = keys.IndexOf(curLevel);
        if (curLevelIndex == -1 || curLevelIndex == 0)
        {
            return 0;
        }
        else
        {
            return keys[curLevelIndex - 1];
        }
    }
 
}