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