You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
4.4 KiB
157 lines
4.4 KiB
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<int, SynthesisConfig> dict = new Dictionary<int, SynthesisConfig>(); |
|
|
|
[BsonElement] |
|
[ProtoMember(1)] |
|
private List<SynthesisConfig> list = new List<SynthesisConfig>(); |
|
|
|
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<int, SynthesisConfig> GetAll() |
|
{ |
|
return this.dict; |
|
} |
|
|
|
public List<SynthesisConfig> 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 |
|
{ |
|
/// <summary>编号</summary> |
|
[ProtoMember(1)] |
|
public int Id { get; set; } |
|
/// <summary>名称</summary> |
|
[ProtoMember(2)] |
|
public string Name { get; set; } |
|
/// <summary>成品类型</summary> |
|
[ProtoMember(3)] |
|
public int MixtureTpye { get; set; } |
|
/// <summary>成品ID</summary> |
|
[ProtoMember(4)] |
|
public int MixtureID { get; set; } |
|
/// <summary>优质成品ID</summary> |
|
[ProtoMember(5)] |
|
public int QualityMixtureID { get; set; } |
|
/// <summary>体量</summary> |
|
[ProtoMember(6)] |
|
public int BodyVolume { get; set; } |
|
/// <summary>合成耗时</summary> |
|
[ProtoMember(7)] |
|
public int TimeConsume { get; set; } |
|
/// <summary>合成份数</summary> |
|
[ProtoMember(8)] |
|
public int Copies { get; set; } |
|
/// <summary>优质合成份数</summary> |
|
[ProtoMember(9)] |
|
public int QualityCopies { get; set; } |
|
/// <summary>建筑编号</summary> |
|
[ProtoMember(10)] |
|
public int[] StructureID { get; set; } |
|
/// <summary>技能需求</summary> |
|
[ProtoMember(11)] |
|
public int SkillCondition { get; set; } |
|
/// <summary>显示条件类型</summary> |
|
[ProtoMember(12)] |
|
public int DisplayCondition { get; set; } |
|
/// <summary>条件参数</summary> |
|
[ProtoMember(13)] |
|
public int Parameter { get; set; } |
|
/// <summary>解锁条件</summary> |
|
[ProtoMember(14)] |
|
public int UnlockCondition { get; set; } |
|
/// <summary>条件参数</summary> |
|
[ProtoMember(15)] |
|
public int Parameter2 { get; set; } |
|
/// <summary>繁荣值需求</summary> |
|
[ProtoMember(16)] |
|
public int BoomCondition { get; set; } |
|
/// <summary>科技编号</summary> |
|
[ProtoMember(17)] |
|
public int ScienceId { get; set; } |
|
/// <summary>物品编号</summary> |
|
[ProtoMember(18)] |
|
public int[] ItemId { get; set; } |
|
/// <summary>物品数量</summary> |
|
[ProtoMember(19)] |
|
public int[] ItemNum { get; set; } |
|
/// <summary>批量制作所需熟练度</summary> |
|
[ProtoMember(20)] |
|
public int NeedProficiency { get; set; } |
|
/// <summary>单个产出熟练度增长值</summary> |
|
[ProtoMember(21)] |
|
public int ProficiencyPerItem { get; set; } |
|
/// <summary>优质单个产出熟练度增长值</summary> |
|
[ProtoMember(22)] |
|
public int QualityProficiencyPerItem { get; set; } |
|
/// <summary>可控条件类型</summary> |
|
[ProtoMember(23)] |
|
public int ControllableFactor { get; set; } |
|
/// <summary>可控条件要求</summary> |
|
[ProtoMember(24)] |
|
public int[] FactorDemand { get; set; } |
|
|
|
} |
|
}
|
|
|