using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class SkillBuffConfigCategory : ProtoObject, IMerge { public static SkillBuffConfigCategory Instance; [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public SkillBuffConfigCategory() { Instance = this; } public void Merge(object o) { SkillBuffConfigCategory s = o as SkillBuffConfigCategory; this.list.AddRange(s.list); } public override void EndInit() { foreach (SkillBuffConfig config in list) { config.EndInit(); this.dict.Add(config.Id, config); } this.AfterEndInit(); } public SkillBuffConfig Get(int id) { this.dict.TryGetValue(id, out SkillBuffConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (SkillBuffConfig)},配置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 SkillBuffConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class SkillBuffConfig: ProtoObject, IConfig { /// 编号 [ProtoMember(1)] public int Id { get; set; } /// 名称 [ProtoMember(2)] public string Name { get; set; } /// 触发事件 [ProtoMember(3)] public int TriggerEvent { get; set; } /// 触发参数 [ProtoMember(4)] public int TriggerParameter { get; set; } /// 目标类型 [ProtoMember(5)] public int ObjectType { get; set; } /// 范围类型 [ProtoMember(6)] public int ScopeType { get; set; } /// 冷却类型 [ProtoMember(7)] public int CDType { get; set; } /// 冷却参数 [ProtoMember(8)] public int CDParameter { get; set; } /// 增益性 [ProtoMember(9)] public int Gain { get; set; } /// 可被驱散 [ProtoMember(10)] public int Disperse { get; set; } /// 持续类型 [ProtoMember(11)] public int ContinuedType { get; set; } /// 持续参数 [ProtoMember(12)] public int ContinuedParameter { get; set; } /// BUFF概率 [ProtoMember(13)] public int BuffProbability { get; set; } /// 关联效果 [ProtoMember(14)] public int[] LinkEffect { get; set; } /// 生效触发 [ProtoMember(15)] public int[] StartTrigger { get; set; } /// 消失触发 [ProtoMember(16)] public int EndTrigger { get; set; } /// 是否叠加 [ProtoMember(17)] public int Overlay { get; set; } /// 最大叠加 [ProtoMember(18)] public int OverlayMax { get; set; } /// 图标 [ProtoMember(19)] public string Icon { get; set; } /// 战斗显示 [ProtoMember(20)] public int BattleShow { get; set; } /// 描述 [ProtoMember(21)] public string Describe { get; set; } } }