hch
2026-01-26 aa84cb62bebb9c8a4e586bcc1ec28eb7a16a8860
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
using System.Collections.Generic;
public partial class PresetUnlockConfig : ConfigBase<int, PresetUnlockConfig>
{
    static Dictionary<int, Dictionary<int, PresetUnlockConfig>> m_PresetUnlockDict = new Dictionary<int, Dictionary<int, PresetUnlockConfig>>();
    static Dictionary<int, int> m_UnLockTypeDict = new Dictionary<int, int>();  // 预设类型 解锁类型,暂约定只有1种
    protected override void OnConfigParseCompleted()
    {
        if (!m_PresetUnlockDict.ContainsKey(PresetType))
        {
            m_PresetUnlockDict[PresetType] = new Dictionary<int, PresetUnlockConfig>();
        }
        m_PresetUnlockDict[PresetType][PresetID] = this;
 
        if (!m_UnLockTypeDict.ContainsKey(PresetType))
        {
            m_UnLockTypeDict[PresetType] = UnlockType;
        }
        else if (m_UnLockTypeDict[PresetType] < UnlockType)
        {
            m_UnLockTypeDict[PresetType] = UnlockType;
        }
    }
 
    public static PresetUnlockConfig GetPresetUnlockConfig(int presetType, int presetID)
    {
        if (m_PresetUnlockDict.ContainsKey(presetType) && m_PresetUnlockDict[presetType].ContainsKey(presetID))
        {
            return m_PresetUnlockDict[presetType][presetID];
        }
        return null;
    }
 
    public static int GetUnlockType(int presetType)
    {
        if (m_UnLockTypeDict.ContainsKey(presetType))
        {
            return m_UnLockTypeDict[presetType];
        }
        return 0;
    }
 
    public static int GetFuncPresetMaxCount(int presetType)
    {
        if (m_PresetUnlockDict.ContainsKey(presetType))
        {
            return m_PresetUnlockDict[presetType].Count;
        }
        return 0;
    }
 
}