yyl
2025-06-17 007fbd542c30f5fa8308128aac26ce6584b3067a
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
using System.Collections.Generic;
using UnityEngine;
 
public partial class HeroTalentConfig : ConfigBase<int, HeroTalentConfig>
{
    // public int Quality;
    // public int AttrID;
 
    // Quality, List<HeroTalentConfig>
    public static Dictionary<int, List<HeroTalentConfig>> configDics = new Dictionary<int, List<HeroTalentConfig>>();
 
    protected override void OnConfigParseCompleted()
    {
        base.OnConfigParseCompleted();
 
        List<HeroTalentConfig> list = null;
        if (!configDics.TryGetValue(Quality, out list))
        {
            list = new List<HeroTalentConfig>();
            configDics.Add(Quality, list);
        }
        list.Add(this);
    }
 
    public static List<HeroTalentConfig> GetTalentListByQuality(int quality)
    {
        List<HeroTalentConfig> list = null;
        if (configDics.TryGetValue(quality, out list))
        {
            return list;
        }
        return null;
    }
 
    /// <summary>
    /// 所有品质的列表按AttrID升序排序(需在所有配置加载完后调用一次)
    /// </summary>
    public static void SortAllByAttrID()
    {
        foreach (var pair in configDics)
        {
            pair.Value.Sort((a, b) => a.AttrID.CompareTo(b.AttrID));
        }
    }
 
    protected override void AllConfigLoadFinish()
    {   
        base.AllConfigLoadFinish();
        //  排序
        SortAllByAttrID();
    }
}