using System; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; using ProtoBuf; namespace ET { [ProtoContract] [Config] public partial class ItemConfigCategory : ConfigSingleton, IMerge { [ProtoIgnore] [BsonIgnore] private Dictionary dict = new Dictionary(); [BsonElement] [ProtoMember(1)] private List list = new List(); public void Merge(object o) { ItemConfigCategory s = o as ItemConfigCategory; this.list.AddRange(s.list); } [ProtoAfterDeserialization] public void ProtoEndInit() { foreach (ItemConfig config in list) { config.AfterEndInit(); this.dict.Add(config.Id, config); } this.list.Clear(); this.AfterEndInit(); } public ItemConfig Get(int id) { this.dict.TryGetValue(id, out ItemConfig item); if (item == null) { throw new Exception($"配置找不到,配置表名: {nameof (ItemConfig)},配置id: {id}"); } return item; } public bool Contain(int id) { return this.dict.ContainsKey(id); } public Dictionary GetAll() { return this.dict; } public ItemConfig GetOne() { if (this.dict == null || this.dict.Count <= 0) { return null; } return this.dict.Values.GetEnumerator().Current; } } [ProtoContract] public partial class ItemConfig: ProtoObject, IConfig { /// Id [ProtoMember(1)] public int Id { get; set; } /// 名称 [ProtoMember(2)] public string Name { get; set; } /// 类型 [ProtoMember(3)] public string Type { get; set; } /// 描述 [ProtoMember(4)] public string Desc { get; set; } /// 帮助说明 [ProtoMember(5)] public string Tips { get; set; } /// 获得说明 [ProtoMember(6)] public string Ways { get; set; } /// 基础价格 [ProtoMember(7)] public int Price { get; set; } /// 寄卖基础价格 [ProtoMember(8)] public int SalePrice { get; set; } /// 等级需求 [ProtoMember(9)] public int LevelReq { get; set; } /// 成色 [ProtoMember(10)] public int Qcolor { get; set; } /// 使用间隔 [ProtoMember(11)] public int UseCD { get; set; } /// 属性1 [ProtoMember(12)] public string Prop { get; set; } /// 参数1 [ProtoMember(13)] public int Par { get; set; } /// 最小值1 [ProtoMember(14)] public int Min { get; set; } /// 最大值1 [ProtoMember(15)] public int Max { get; set; } /// 图标文件 [ProtoMember(17)] public string Icon { get; set; } /// 重叠数量 [ProtoMember(18)] public int GroupCount { get; set; } /// 购买上限 [ProtoMember(19)] public int PurchaseCount { get; set; } /// 合成公式 [ProtoMember(20)] public int DestID { get; set; } /// 可使用 [ProtoMember(21)] public int IsApply { get; set; } /// 可立即使用 [ProtoMember(22)] public int IsApplyNow { get; set; } /// 使用说明 [ProtoMember(23)] public string ApplyTips { get; set; } /// 绑定规则 [ProtoMember(24)] public int BindType { get; set; } /// 组队分配 [ProtoMember(25)] public int ReserveType { get; set; } /// 竞价底价 [ProtoMember(26)] public int ReservePrice { get; set; } /// 分解道具 [ProtoMember(27)] public string Disintegration { get; set; } /// 分解获得具体 [ProtoMember(28)] public string BranchAura { get; set; } /// 不可分解 [ProtoMember(29)] public int NoDestory { get; set; } /// 不可出售 [ProtoMember(30)] public int NoSell { get; set; } /// 不可交易 [ProtoMember(31)] public int NoTrade { get; set; } /// 不可寄卖 [ProtoMember(32)] public int NoAuction { get; set; } /// 不可存入个人仓库 [ProtoMember(33)] public int NoDepotRole { get; set; } /// 不可存入账号仓库 [ProtoMember(34)] public int NoDepotAcc { get; set; } /// 不可存入公会仓库 [ProtoMember(35)] public int NoDepotGuild { get; set; } /// 模型ID [ProtoMember(36)] public string ShowId { get; set; } /// 途径功能ID [ProtoMember(37)] public string WaysID { get; set; } } }