using System.Collections.Generic; public partial class HeroInfo { //继承百分比对应三围,对应属性条目表里的ID private Dictionary _inheritPer; Dictionary inheritPer { get { if (_inheritPer == null) { _inheritPer = new Dictionary() { { 6, heroConfig.AtkInheritPer }, { 7, heroConfig.DefInheritPer }, { 8, heroConfig.HPInheritPer }, }; } return _inheritPer; } } public int GetInheritAttrPer(int attrType) { return inheritPer.TryGetValue(attrType, out int value) ? value : 0; } }