using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class StructureConfigCategory : ProtoObject, IMerge { public static StructureConfigCategory Instance; [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public StructureConfigCategory() { Instance = this; } public void Merge(object o) { StructureConfigCategory s = o as StructureConfigCategory; this.list.AddRange(s.list); } public override void EndInit() { foreach (StructureConfig config in list) { config.EndInit(); this.dict.Add(config.Id, config); } this.AfterEndInit(); } public StructureConfig Get(int id) { this.dict.TryGetValue(id, out StructureConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (StructureConfig)},配置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 StructureConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class StructureConfig: ProtoObject, IConfig { /// 编号 [ProtoMember(1)] public int Id { get; set; } /// 名称 [ProtoMember(2)] public string Name { get; set; } /// 建筑类型 [ProtoMember(3)] public int Type { get; set; } /// 耐久度 [ProtoMember(4)] public int Durable { get; set; } /// 耐久减损系数 [ProtoMember(5)] public int DurableCoefficient { get; set; } /// 修理金币数量 [ProtoMember(6)] public int FirmCoinNum { get; set; } /// 完成建造元宝数量 [ProtoMember(7)] public int CompleteMoneyNum { get; set; } /// 特殊功能 [ProtoMember(8)] public int Special { get; set; } /// 功能参数 [ProtoMember(9)] public int Function { get; set; } /// 居住人数 [ProtoMember(10)] public int DwellNumber { get; set; } /// 家禽量 [ProtoMember(11)] public int PoultryNum { get; set; } /// 舒适度 [ProtoMember(12)] public int Comfortable { get; set; } /// 繁荣值 [ProtoMember(13)] public int Boom { get; set; } /// 升级序列 [ProtoMember(14)] public int UpgradeSequence { get; set; } /// 关联科技 [ProtoMember(15)] public int[] RelatedTechnology { get; set; } /// 关联BUFF [ProtoMember(16)] public int State { get; set; } /// BUFF效果 [ProtoMember(17)] public int StateAffection { get; set; } /// 特定点 [ProtoMember(18)] public int SpecificPoint { get; set; } /// 开关功能 [ProtoMember(19)] public int ON_OFF { get; set; } /// 攻击频率 [ProtoMember(20)] public int AtcFrequency { get; set; } /// 攻击力 [ProtoMember(21)] public int Atc { get; set; } /// 目标数量 [ProtoMember(22)] public int TargetNum { get; set; } /// 预置文件 [ProtoMember(23)] public string Prefab { get; set; } /// 可否移动 [ProtoMember(24)] public int CanMove { get; set; } /// 图标 [ProtoMember(25)] public string Picture { get; set; } /// 描述 [ProtoMember(26)] public string Describe { get; set; } /// 可拆除 [ProtoMember(27)] public int Remove { get; set; } } }