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.
142 lines
3.7 KiB
142 lines
3.7 KiB
using System; |
|
using System.Collections.Generic; |
|
using MongoDB.Bson.Serialization.Attributes; |
|
using ProtoBuf; |
|
|
|
namespace ET |
|
{ |
|
[ProtoContract] |
|
[Config] |
|
public partial class AllItemConfigCategory : ProtoObject, IMerge |
|
{ |
|
public static AllItemConfigCategory Instance; |
|
|
|
[ProtoIgnore] |
|
[BsonIgnore] |
|
private Dictionary<int, AllItemConfig> dict = new Dictionary<int, AllItemConfig>(); |
|
|
|
[BsonElement] |
|
[ProtoMember(1)] |
|
private List<AllItemConfig> list = new List<AllItemConfig>(); |
|
|
|
public AllItemConfigCategory() |
|
{ |
|
Instance = this; |
|
} |
|
|
|
public void Merge(object o) |
|
{ |
|
AllItemConfigCategory s = o as AllItemConfigCategory; |
|
this.list.AddRange(s.list); |
|
} |
|
|
|
public override void EndInit() |
|
{ |
|
foreach (AllItemConfig config in list) |
|
{ |
|
config.EndInit(); |
|
this.dict.Add(config.Id, config); |
|
} |
|
this.AfterEndInit(); |
|
} |
|
|
|
public AllItemConfig Get(int id) |
|
{ |
|
this.dict.TryGetValue(id, out AllItemConfig item); |
|
|
|
if (item == null) |
|
{ |
|
throw new Exception($"配置找不到,配置表名: {nameof (AllItemConfig)},配置id: {id}"); |
|
} |
|
|
|
return item; |
|
} |
|
|
|
public bool Contain(int id) |
|
{ |
|
return this.dict.ContainsKey(id); |
|
} |
|
|
|
public Dictionary<int, AllItemConfig> GetAll() |
|
{ |
|
return this.dict; |
|
} |
|
|
|
public List<AllItemConfig> GetList() |
|
{ |
|
return this.list; |
|
} |
|
|
|
public AllItemConfig GetOne() |
|
{ |
|
if (this.dict == null || this.dict.Count <= 0) |
|
{ |
|
return null; |
|
} |
|
return this.dict.Values.GetEnumerator().Current; |
|
} |
|
} |
|
|
|
[ProtoContract] |
|
public partial class AllItemConfig: 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 RelatedTable { get; set; } |
|
/// <summary>子表编号</summary> |
|
[ProtoMember(4)] |
|
public int RelatedId { get; set; } |
|
/// <summary>仓库类别</summary> |
|
[ProtoMember(5)] |
|
public int StockType { get; set; } |
|
/// <summary>仓库子类别</summary> |
|
[ProtoMember(6)] |
|
public int StockSecondaryType { get; set; } |
|
/// <summary>转移性</summary> |
|
[ProtoMember(7)] |
|
public int Transfer { get; set; } |
|
/// <summary>可出售</summary> |
|
[ProtoMember(8)] |
|
public int Sell { get; set; } |
|
/// <summary>出售货币</summary> |
|
[ProtoMember(9)] |
|
public int SellMoney { get; set; } |
|
/// <summary>出售价格</summary> |
|
[ProtoMember(10)] |
|
public int SellPrice { get; set; } |
|
/// <summary>购买货币</summary> |
|
[ProtoMember(11)] |
|
public int BuyMoney { get; set; } |
|
/// <summary>购买价格</summary> |
|
[ProtoMember(12)] |
|
public int BuyPrice { get; set; } |
|
/// <summary>购买上限</summary> |
|
[ProtoMember(13)] |
|
public int PurchaseMax { get; set; } |
|
/// <summary>叠加上限</summary> |
|
[ProtoMember(14)] |
|
public long SuperpositionMax { get; set; } |
|
/// <summary>可丢弃</summary> |
|
[ProtoMember(15)] |
|
public int AbleThrow { get; set; } |
|
/// <summary>品级</summary> |
|
[ProtoMember(16)] |
|
public int Grade { get; set; } |
|
/// <summary>图标</summary> |
|
[ProtoMember(17)] |
|
public string Icon { get; set; } |
|
/// <summary>物品描述</summary> |
|
[ProtoMember(18)] |
|
public string Description { get; set; } |
|
/// <summary>来源描述</summary> |
|
[ProtoMember(19)] |
|
public string GetMethod { get; set; } |
|
|
|
} |
|
}
|
|
|