using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class SkillFatherConfigCategory : ProtoObject, IMerge { public static SkillFatherConfigCategory Instance; [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public SkillFatherConfigCategory() { Instance = this; } public void Merge(object o) { SkillFatherConfigCategory s = o as SkillFatherConfigCategory; this.list.AddRange(s.list); } public override void EndInit() { foreach (SkillFatherConfig config in list) { config.EndInit(); this.dict.Add(config.Id, config); } this.AfterEndInit(); } public SkillFatherConfig Get(int id) { this.dict.TryGetValue(id, out SkillFatherConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (SkillFatherConfig)},配置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 SkillFatherConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class SkillFatherConfig: ProtoObject, IConfig { /// 编号 [ProtoMember(1)] public int Id { get; set; } /// 技能名称 [ProtoMember(2)] public string SkillName { get; set; } /// 武器限制 [ProtoMember(3)] public int Weapon { get; set; } /// 学习等级 [ProtoMember(4)] public int LearningLevel { get; set; } /// 类型 [ProtoMember(5)] public int Type { get; set; } /// 技能类型 [ProtoMember(6)] public int SkillType { get; set; } /// 施放类型 [ProtoMember(7)] public int ActionType { get; set; } /// 可否被沉默 [ProtoMember(8)] public int Silence { get; set; } /// 技能近身性 [ProtoMember(9)] public int GetClose { get; set; } /// 冷却类型 [ProtoMember(10)] public int CDType { get; set; } /// 冷却参数 [ProtoMember(11)] public int CDParameter { get; set; } /// 等级上限 [ProtoMember(12)] public int LevelCap { get; set; } /// 战意消耗 [ProtoMember(13)] public int FightingSpiritConsume { get; set; } /// 属性1 [ProtoMember(14)] public int Attribute1 { get; set; } /// 属性1参数 [ProtoMember(15)] public string Attribute1Parameter { get; set; } /// 属性2 [ProtoMember(16)] public int Attribute2 { get; set; } /// 属性2参数 [ProtoMember(17)] public string Attribute2Parameter { get; set; } /// 子技能组 [ProtoMember(18)] public int[] SkillSonGroup { get; set; } /// 升级组 [ProtoMember(19)] public int SkillUp { get; set; } /// 技能图标 [ProtoMember(20)] public string Icon { get; set; } /// 技能描述 [ProtoMember(21)] public string Describe { get; set; } } }