hch
95 分钟以前 6387f27214a8409dfd3954ca76d354571ce56ea9
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
using System.Collections.Generic;
using System.Linq;
public partial class ActLunhuidianTypeConfig : ConfigBase<int, ActLunhuidianTypeConfig>
{
    static List<int> tabIndexList = new List<int>();
    //<轮回类型,<界面类型,配置ID>>
    static Dictionary<int, Dictionary<int, int>> infoDict = new Dictionary<int, Dictionary<int, int>>();
 
    protected override void OnConfigParseCompleted()
    {
        if (!infoDict.ContainsKey(RoundType))
            infoDict[RoundType] = new Dictionary<int, int>();
        infoDict[RoundType][TabType] = ID;
    }
 
    public static List<int> GetTabList()
    {
        if (tabIndexList.IsNullOrEmpty())
        {
            tabIndexList = GetKeys().OrderBy(id => Get(id)?.TabSort ?? int.MaxValue).ToList();
        }
        return tabIndexList;
    }
 
    public static int GetId(int roundType, int tabType)
    {
        return infoDict.TryGetValue(roundType, out var info) && info.TryGetValue(tabType, out var index) ? index : 0;
    }
 
    public static bool TryGetId(int roundType, int tabType, out int id)
    {
        id = 0;
        return infoDict != null && infoDict.TryGetValue(roundType, out var info) && info.TryGetValue(tabType, out id);
    }
 
    public static bool TryGetConfig(int id, out ActLunhuidianTypeConfig config)
    {
        config = null;
        if (!HasKey(id))
            return false;
        config = Get(id);
        return true;
    }
 
    public static bool TryGetConfig(int roundType, int tabType, out ActLunhuidianTypeConfig config)
    {
        config = null;
        if (!TryGetId(roundType, tabType, out int id))
            return false;
        return TryGetConfig(id, out config);
    }
 
 
}