|   | 
| using System.Collections.Generic; | 
| using System.IO; | 
| using System; | 
| using UnityEngine; | 
| using LitJson; | 
| using System.Linq; | 
|   | 
| //羁绊:武将 | 
| 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; | 
|     } | 
|   | 
|   | 
| } |