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.
140 lines
3.6 KiB
140 lines
3.6 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using MongoDB.Bson.Serialization.Attributes;
|
||
|
using ProtoBuf;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[ProtoContract]
|
||
|
[Config]
|
||
|
public partial class StateConfigCategory : ProtoObject, IMerge
|
||
|
{
|
||
|
public static StateConfigCategory Instance;
|
||
|
|
||
|
[ProtoIgnore]
|
||
|
[BsonIgnore]
|
||
|
private Dictionary<int, StateConfig> dict = new Dictionary<int, StateConfig>();
|
||
|
|
||
|
[BsonElement]
|
||
|
[ProtoMember(1)]
|
||
|
private List<StateConfig> list = new List<StateConfig>();
|
||
|
|
||
|
public StateConfigCategory()
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
|
||
|
public void Merge(object o)
|
||
|
{
|
||
|
StateConfigCategory s = o as StateConfigCategory;
|
||
|
this.list.AddRange(s.list);
|
||
|
}
|
||
|
|
||
|
public override void EndInit()
|
||
|
{
|
||
|
foreach (StateConfig config in list)
|
||
|
{
|
||
|
config.EndInit();
|
||
|
this.dict.Add(config.Id, config);
|
||
|
}
|
||
|
this.AfterEndInit();
|
||
|
}
|
||
|
|
||
|
public StateConfig Get(int id)
|
||
|
{
|
||
|
this.dict.TryGetValue(id, out StateConfig item);
|
||
|
|
||
|
if (item == null)
|
||
|
{
|
||
|
throw new Exception($"配置找不到,配置表名: {nameof (StateConfig)},配置id: {id}");
|
||
|
}
|
||
|
|
||
|
return item;
|
||
|
}
|
||
|
|
||
|
public bool Contain(int id)
|
||
|
{
|
||
|
return this.dict.ContainsKey(id);
|
||
|
}
|
||
|
|
||
|
public Dictionary<int, StateConfig> GetAll()
|
||
|
{
|
||
|
return this.dict;
|
||
|
}
|
||
|
|
||
|
public List<StateConfig> GetList()
|
||
|
{
|
||
|
return this.list;
|
||
|
}
|
||
|
|
||
|
public StateConfig GetOne()
|
||
|
{
|
||
|
if (this.dict == null || this.dict.Count <= 0)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
return this.dict.Values.GetEnumerator().Current;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[ProtoContract]
|
||
|
public partial class StateConfig: ProtoObject, IConfig
|
||
|
{
|
||
|
/// <summary>编号</summary>
|
||
|
[ProtoMember(1)]
|
||
|
public int Id { get; set; }
|
||
|
/// <summary>类型</summary>
|
||
|
[ProtoMember(2)]
|
||
|
public int Type { get; set; }
|
||
|
/// <summary>状态名称</summary>
|
||
|
[ProtoMember(3)]
|
||
|
public string Name { get; set; }
|
||
|
/// <summary>BUFF所属对象</summary>
|
||
|
[ProtoMember(4)]
|
||
|
public int[] Subject { get; set; }
|
||
|
/// <summary>BUFF影响对象</summary>
|
||
|
[ProtoMember(5)]
|
||
|
public int[] Object { get; set; }
|
||
|
/// <summary>作用对象参数</summary>
|
||
|
[ProtoMember(6)]
|
||
|
public int[] ObjectParameter { get; set; }
|
||
|
/// <summary>等级</summary>
|
||
|
[ProtoMember(7)]
|
||
|
public int Lv { get; set; }
|
||
|
/// <summary>组类型</summary>
|
||
|
[ProtoMember(8)]
|
||
|
public int Cover { get; set; }
|
||
|
/// <summary>合成物品类型</summary>
|
||
|
[ProtoMember(9)]
|
||
|
public int SyntheticType { get; set; }
|
||
|
/// <summary>效果类型</summary>
|
||
|
[ProtoMember(10)]
|
||
|
public int[] Effection { get; set; }
|
||
|
/// <summary>效果数值</summary>
|
||
|
[ProtoMember(11)]
|
||
|
public int[] EffectionValue { get; set; }
|
||
|
/// <summary>能否劳作</summary>
|
||
|
[ProtoMember(12)]
|
||
|
public int Toil { get; set; }
|
||
|
/// <summary>能否叠加</summary>
|
||
|
[ProtoMember(13)]
|
||
|
public int Superimposed { get; set; }
|
||
|
/// <summary>持续时间</summary>
|
||
|
[ProtoMember(14)]
|
||
|
public int Duration { get; set; }
|
||
|
/// <summary>状态图标</summary>
|
||
|
[ProtoMember(15)]
|
||
|
public string Icon { get; set; }
|
||
|
/// <summary>是否显示</summary>
|
||
|
[ProtoMember(16)]
|
||
|
public int Display { get; set; }
|
||
|
/// <summary>状态描述</summary>
|
||
|
[ProtoMember(17)]
|
||
|
public string Describe { get; set; }
|
||
|
/// <summary>效果读取状态描述</summary>
|
||
|
[ProtoMember(18)]
|
||
|
public string Description2 { get; set; }
|
||
|
|
||
|
}
|
||
|
}
|