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
 
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System;
using UnityEngine;
using LitJson;
 
public partial class HeroFetterConfig : ConfigBase<int, HeroFetterConfig>
{
    private Dictionary<HeroAttrType, int> attrValues = new Dictionary<HeroAttrType, int>();
 
    protected override void OnConfigParseCompleted()
    {
        base.OnConfigParseCompleted();
 
        // public int[] AttrIDList;
        // public int[] AttrValueList;
 
        if (AttrIDList.Length != AttrValueList.Length)
        {
            Debug.LogError("HeroFetterConfig 配置错误 " + FetterID);
            return;
        }
 
        for (int i = 0; i < AttrIDList.Length; i++)
        {
            HeroAttrType attrType = (HeroAttrType)AttrIDList[i];
            if (attrValues.ContainsKey(attrType))
            {
                Debug.LogError("HeroFetterConfig 配置错误 " + FetterID);
                return;
            }
 
            attrValues.Add((HeroAttrType)AttrIDList[i], AttrValueList[i]);
        }
    }
 
    public int GetFetterAttr(HeroAttrType attrType)
    {
        if (attrValues.TryGetValue(attrType, out int value))
        {
            return value;
        }
 
        return 0;
    }
}