using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class SynthesisConfigCategory : ProtoObject, IMerge { public static SynthesisConfigCategory Instance; [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public SynthesisConfigCategory() { Instance = this; } public void Merge(object o) { SynthesisConfigCategory s = o as SynthesisConfigCategory; this.list.AddRange(s.list); } public override void EndInit() { foreach (SynthesisConfig config in list) { config.EndInit(); this.dict.Add(config.Id, config); } this.AfterEndInit(); } public SynthesisConfig Get(int id) { this.dict.TryGetValue(id, out SynthesisConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (SynthesisConfig)},配置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 SynthesisConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class SynthesisConfig: ProtoObject, IConfig { /// 编号 [ProtoMember(1)] public int Id { get; set; } /// 名称 [ProtoMember(2)] public string Name { get; set; } /// 成品类型 [ProtoMember(3)] public int MixtureTpye { get; set; } /// 成品ID [ProtoMember(4)] public int MixtureID { get; set; } /// 优质成品ID [ProtoMember(5)] public int QualityMixtureID { get; set; } /// 体量 [ProtoMember(6)] public int BodyVolume { get; set; } /// 合成耗时 [ProtoMember(7)] public int TimeConsume { get; set; } /// 合成份数 [ProtoMember(8)] public int Copies { get; set; } /// 优质合成份数 [ProtoMember(9)] public int QualityCopies { get; set; } /// 建筑编号 [ProtoMember(10)] public int[] StructureID { get; set; } /// 技能需求 [ProtoMember(11)] public int SkillCondition { get; set; } /// 显示条件类型 [ProtoMember(12)] public int DisplayCondition { get; set; } /// 条件参数 [ProtoMember(13)] public int Parameter { get; set; } /// 解锁条件 [ProtoMember(14)] public int UnlockCondition { get; set; } /// 条件参数 [ProtoMember(15)] public int Parameter2 { get; set; } /// 繁荣值需求 [ProtoMember(16)] public int BoomCondition { get; set; } /// 科技编号 [ProtoMember(17)] public int ScienceId { get; set; } /// 物品编号 [ProtoMember(18)] public int[] ItemId { get; set; } /// 物品数量 [ProtoMember(19)] public int[] ItemNum { get; set; } /// 批量制作所需熟练度 [ProtoMember(20)] public int NeedProficiency { get; set; } /// 单个产出熟练度增长值 [ProtoMember(21)] public int ProficiencyPerItem { get; set; } /// 优质单个产出熟练度增长值 [ProtoMember(22)] public int QualityProficiencyPerItem { get; set; } /// 可控条件类型 [ProtoMember(23)] public int ControllableFactor { get; set; } /// 可控条件要求 [ProtoMember(24)] public int[] FactorDemand { get; set; } } }