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.
166 lines
4.5 KiB
166 lines
4.5 KiB
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<int, StructureConfig> dict = new Dictionary<int, StructureConfig>(); |
|
|
|
[BsonElement] |
|
[ProtoMember(1)] |
|
private List<StructureConfig> list = new List<StructureConfig>(); |
|
|
|
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<int, StructureConfig> GetAll() |
|
{ |
|
return this.dict; |
|
} |
|
|
|
public List<StructureConfig> 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 |
|
{ |
|
/// <summary>编号</summary> |
|
[ProtoMember(1)] |
|
public int Id { get; set; } |
|
/// <summary>名称</summary> |
|
[ProtoMember(2)] |
|
public string Name { get; set; } |
|
/// <summary>建筑类型</summary> |
|
[ProtoMember(3)] |
|
public int Type { get; set; } |
|
/// <summary>耐久度</summary> |
|
[ProtoMember(4)] |
|
public int Durable { get; set; } |
|
/// <summary>耐久减损系数</summary> |
|
[ProtoMember(5)] |
|
public int DurableCoefficient { get; set; } |
|
/// <summary>修理金币数量</summary> |
|
[ProtoMember(6)] |
|
public int FirmCoinNum { get; set; } |
|
/// <summary>完成建造元宝数量</summary> |
|
[ProtoMember(7)] |
|
public int CompleteMoneyNum { get; set; } |
|
/// <summary>特殊功能</summary> |
|
[ProtoMember(8)] |
|
public int Special { get; set; } |
|
/// <summary>功能参数</summary> |
|
[ProtoMember(9)] |
|
public int Function { get; set; } |
|
/// <summary>居住人数</summary> |
|
[ProtoMember(10)] |
|
public int DwellNumber { get; set; } |
|
/// <summary>家禽量</summary> |
|
[ProtoMember(11)] |
|
public int PoultryNum { get; set; } |
|
/// <summary>舒适度</summary> |
|
[ProtoMember(12)] |
|
public int Comfortable { get; set; } |
|
/// <summary>繁荣值</summary> |
|
[ProtoMember(13)] |
|
public int Boom { get; set; } |
|
/// <summary>升级序列</summary> |
|
[ProtoMember(14)] |
|
public int UpgradeSequence { get; set; } |
|
/// <summary>关联科技</summary> |
|
[ProtoMember(15)] |
|
public int[] RelatedTechnology { get; set; } |
|
/// <summary>关联BUFF</summary> |
|
[ProtoMember(16)] |
|
public int State { get; set; } |
|
/// <summary>BUFF效果</summary> |
|
[ProtoMember(17)] |
|
public int StateAffection { get; set; } |
|
/// <summary>特定点</summary> |
|
[ProtoMember(18)] |
|
public int SpecificPoint { get; set; } |
|
/// <summary>开关功能</summary> |
|
[ProtoMember(19)] |
|
public int ON_OFF { get; set; } |
|
/// <summary>攻击频率</summary> |
|
[ProtoMember(20)] |
|
public int AtcFrequency { get; set; } |
|
/// <summary>攻击力</summary> |
|
[ProtoMember(21)] |
|
public int Atc { get; set; } |
|
/// <summary>目标数量</summary> |
|
[ProtoMember(22)] |
|
public int TargetNum { get; set; } |
|
/// <summary>预置文件</summary> |
|
[ProtoMember(23)] |
|
public string Prefab { get; set; } |
|
/// <summary>可否移动</summary> |
|
[ProtoMember(24)] |
|
public int CanMove { get; set; } |
|
/// <summary>图标</summary> |
|
[ProtoMember(25)] |
|
public string Picture { get; set; } |
|
/// <summary>描述</summary> |
|
[ProtoMember(26)] |
|
public string Describe { get; set; } |
|
/// <summary>可拆除</summary> |
|
[ProtoMember(27)] |
|
public int Remove { get; set; } |
|
|
|
} |
|
}
|
|
|