using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class AttributesGroupConfigCategory : ProtoObject, IMerge { public static AttributesGroupConfigCategory Instance; [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public AttributesGroupConfigCategory() { Instance = this; } public void Merge(object o) { AttributesGroupConfigCategory s = o as AttributesGroupConfigCategory; this.list.AddRange(s.list); } public override void EndInit() { foreach (AttributesGroupConfig config in list) { config.EndInit(); this.dict.Add(config.Id, config); } this.AfterEndInit(); } public AttributesGroupConfig Get(int id) { this.dict.TryGetValue(id, out AttributesGroupConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (AttributesGroupConfig)},配置id: {id}"); } return item; } public bool Contain(int id) { return this.dict.ContainsKey(id); } public Dictionary GetAll() { return this.dict; } public List GetList() { return this.list; } public AttributesGroupConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class AttributesGroupConfig: ProtoObject, IConfig { /// 编号 [ProtoMember(1)] public int Id { get; set; } /// 等级 [ProtoMember(2)] public int Lv { get; set; } /// 统帅力 [ProtoMember(3)] public int Domination { get; set; } /// 初始火抗 [ProtoMember(4)] public int StarFireResistance { get; set; } /// 初始雷抗 [ProtoMember(5)] public int StarThunderResistance { get; set; } /// 初始毒抗 [ProtoMember(6)] public int StarPoisonResistance { get; set; } /// 初始冰抗 [ProtoMember(7)] public int StarIceResistance { get; set; } /// 生命成长 [ProtoMember(8)] public int HPGrow { get; set; } /// 防御成长 [ProtoMember(9)] public int DEFGrow { get; set; } /// 攻击成长 [ProtoMember(10)] public int ATKGrow { get; set; } /// 攻速成长 [ProtoMember(11)] public int WSPGrow { get; set; } /// 能量恢复 [ProtoMember(12)] public int MPRecover { get; set; } /// 使用武器 [ProtoMember(13)] public int[] Weapon { get; set; } /// 天赋技能 [ProtoMember(14)] public int Talent { get; set; } /// 初始技能 [ProtoMember(15)] public int SkillSet { get; set; } } }