using System.Collections.Generic; using System.IO; using System.Threading; using System; using UnityEngine; using LitJson; public partial class HeroFetterConfig : ConfigBase { private Dictionary attrValues = new Dictionary(); 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; } }