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.
122 lines
3.1 KiB
122 lines
3.1 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using MongoDB.Bson.Serialization.Attributes;
|
||
|
using ProtoBuf;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[ProtoContract]
|
||
|
[Config]
|
||
|
public partial class WeatherConfigCategory : ProtoObject, IMerge
|
||
|
{
|
||
|
public static WeatherConfigCategory Instance;
|
||
|
|
||
|
[ProtoIgnore]
|
||
|
[BsonIgnore]
|
||
|
private Dictionary<int, WeatherConfig> dict = new Dictionary<int, WeatherConfig>();
|
||
|
|
||
|
[BsonElement]
|
||
|
[ProtoMember(1)]
|
||
|
private List<WeatherConfig> list = new List<WeatherConfig>();
|
||
|
|
||
|
public WeatherConfigCategory()
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
|
||
|
public void Merge(object o)
|
||
|
{
|
||
|
WeatherConfigCategory s = o as WeatherConfigCategory;
|
||
|
this.list.AddRange(s.list);
|
||
|
}
|
||
|
|
||
|
public override void EndInit()
|
||
|
{
|
||
|
foreach (WeatherConfig config in list)
|
||
|
{
|
||
|
config.EndInit();
|
||
|
this.dict.Add(config.Id, config);
|
||
|
}
|
||
|
this.AfterEndInit();
|
||
|
}
|
||
|
|
||
|
public WeatherConfig Get(int id)
|
||
|
{
|
||
|
this.dict.TryGetValue(id, out WeatherConfig item);
|
||
|
|
||
|
if (item == null)
|
||
|
{
|
||
|
throw new Exception($"配置找不到,配置表名: {nameof (WeatherConfig)},配置id: {id}");
|
||
|
}
|
||
|
|
||
|
return item;
|
||
|
}
|
||
|
|
||
|
public bool Contain(int id)
|
||
|
{
|
||
|
return this.dict.ContainsKey(id);
|
||
|
}
|
||
|
|
||
|
public Dictionary<int, WeatherConfig> GetAll()
|
||
|
{
|
||
|
return this.dict;
|
||
|
}
|
||
|
|
||
|
public List<WeatherConfig> GetList()
|
||
|
{
|
||
|
return this.list;
|
||
|
}
|
||
|
|
||
|
public WeatherConfig GetOne()
|
||
|
{
|
||
|
if (this.dict == null || this.dict.Count <= 0)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
return this.dict.Values.GetEnumerator().Current;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[ProtoContract]
|
||
|
public partial class WeatherConfig: 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 Disease { get; set; }
|
||
|
/// <summary>外伤值</summary>
|
||
|
[ProtoMember(4)]
|
||
|
public int Injury { get; set; }
|
||
|
/// <summary>耐久破坏</summary>
|
||
|
[ProtoMember(5)]
|
||
|
public int DurableDestroy { get; set; }
|
||
|
/// <summary>劳力变化</summary>
|
||
|
[ProtoMember(6)]
|
||
|
public int LaborVariety { get; set; }
|
||
|
/// <summary>持续时长</summary>
|
||
|
[ProtoMember(7)]
|
||
|
public int[] Duration { get; set; }
|
||
|
/// <summary>天气CD</summary>
|
||
|
[ProtoMember(8)]
|
||
|
public int[] CD { get; set; }
|
||
|
/// <summary>天气特效</summary>
|
||
|
[ProtoMember(9)]
|
||
|
public string WeaterEffect { get; set; }
|
||
|
/// <summary>特效间隔</summary>
|
||
|
[ProtoMember(10)]
|
||
|
public int[] SpecialEfficacyCD { get; set; }
|
||
|
/// <summary>天气图标</summary>
|
||
|
[ProtoMember(11)]
|
||
|
public string ICON { get; set; }
|
||
|
/// <summary>描述</summary>
|
||
|
[ProtoMember(12)]
|
||
|
public string Describe { get; set; }
|
||
|
|
||
|
}
|
||
|
}
|