using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class SkillSonConfigCategory : ProtoObject, IMerge { public static SkillSonConfigCategory Instance; [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public SkillSonConfigCategory() { Instance = this; } public void Merge(object o) { SkillSonConfigCategory s = o as SkillSonConfigCategory; this.list.AddRange(s.list); } public override void EndInit() { foreach (SkillSonConfig config in list) { config.EndInit(); this.dict.Add(config.Id, config); } this.AfterEndInit(); } public SkillSonConfig Get(int id) { this.dict.TryGetValue(id, out SkillSonConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (SkillSonConfig)},配置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 SkillSonConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class SkillSonConfig: ProtoObject, IConfig { /// 编号 [ProtoMember(1)] public int Id { get; set; } /// 子技能名称 [ProtoMember(2)] public string Name { get; set; } /// 施放类型 [ProtoMember(3)] public int ActionType { get; set; } /// 目标类型 [ProtoMember(4)] public int ObjectType { get; set; } /// 范围类型 [ProtoMember(5)] public int ScopeType { get; set; } /// 施放位置 [ProtoMember(6)] public int CastPosition { get; set; } /// 是否可暴击 [ProtoMember(7)] public int WhetherToCrit { get; set; } /// 可否被打断 [ProtoMember(8)] public int CanBeChase { get; set; } /// 可否被招架 [ProtoMember(9)] public int CanBeParry { get; set; } /// 可否被反击 [ProtoMember(10)] public int CanBeFightBack { get; set; } /// 可否被追击 [ProtoMember(11)] public int CanBeInterrupt { get; set; } /// 可否被援护 [ProtoMember(12)] public int CanBeSupport { get; set; } /// 直接近战伤害 [ProtoMember(13)] public int DirectInjury { get; set; } /// 触发类型 [ProtoMember(14)] public int TriggerType { get; set; } /// 触发参数 [ProtoMember(15)] public int TriggerParameter { get; set; } /// 关联Buff [ProtoMember(16)] public int[] Buff { get; set; } /// 关联子技能 [ProtoMember(17)] public int[] SkillSon { get; set; } /// 是否要解锁 [ProtoMember(18)] public int Unlock { get; set; } /// 招式动作 [ProtoMember(19)] public string Action { get; set; } /// 音效 [ProtoMember(20)] public string Sound { get; set; } /// 图标 [ProtoMember(21)] public string Icon { get; set; } /// 描述 [ProtoMember(22)] public string Describe { get; set; } } }