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.
128 lines
3.5 KiB
128 lines
3.5 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using MongoDB.Bson.Serialization.Attributes;
|
||
|
using ProtoBuf;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[ProtoContract]
|
||
|
[Config]
|
||
|
public partial class MissionSettingConfigCategory : ProtoObject, IMerge
|
||
|
{
|
||
|
public static MissionSettingConfigCategory Instance;
|
||
|
|
||
|
[ProtoIgnore]
|
||
|
[BsonIgnore]
|
||
|
private Dictionary<int, MissionSettingConfig> dict = new Dictionary<int, MissionSettingConfig>();
|
||
|
|
||
|
[BsonElement]
|
||
|
[ProtoMember(1)]
|
||
|
private List<MissionSettingConfig> list = new List<MissionSettingConfig>();
|
||
|
|
||
|
public MissionSettingConfigCategory()
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
|
||
|
public void Merge(object o)
|
||
|
{
|
||
|
MissionSettingConfigCategory s = o as MissionSettingConfigCategory;
|
||
|
this.list.AddRange(s.list);
|
||
|
}
|
||
|
|
||
|
public override void EndInit()
|
||
|
{
|
||
|
foreach (MissionSettingConfig config in list)
|
||
|
{
|
||
|
config.EndInit();
|
||
|
this.dict.Add(config.Id, config);
|
||
|
}
|
||
|
this.AfterEndInit();
|
||
|
}
|
||
|
|
||
|
public MissionSettingConfig Get(int id)
|
||
|
{
|
||
|
this.dict.TryGetValue(id, out MissionSettingConfig item);
|
||
|
|
||
|
if (item == null)
|
||
|
{
|
||
|
throw new Exception($"配置找不到,配置表名: {nameof (MissionSettingConfig)},配置id: {id}");
|
||
|
}
|
||
|
|
||
|
return item;
|
||
|
}
|
||
|
|
||
|
public bool Contain(int id)
|
||
|
{
|
||
|
return this.dict.ContainsKey(id);
|
||
|
}
|
||
|
|
||
|
public Dictionary<int, MissionSettingConfig> GetAll()
|
||
|
{
|
||
|
return this.dict;
|
||
|
}
|
||
|
|
||
|
public List<MissionSettingConfig> GetList()
|
||
|
{
|
||
|
return this.list;
|
||
|
}
|
||
|
|
||
|
public MissionSettingConfig GetOne()
|
||
|
{
|
||
|
if (this.dict == null || this.dict.Count <= 0)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
return this.dict.Values.GetEnumerator().Current;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[ProtoContract]
|
||
|
public partial class MissionSettingConfig: ProtoObject, IConfig
|
||
|
{
|
||
|
/// <summary>编号</summary>
|
||
|
[ProtoMember(1)]
|
||
|
public int Id { get; set; }
|
||
|
/// <summary>任务类型</summary>
|
||
|
[ProtoMember(2)]
|
||
|
public string Type { get; set; }
|
||
|
/// <summary>任务名称</summary>
|
||
|
[ProtoMember(3)]
|
||
|
public string Name { get; set; }
|
||
|
/// <summary>子任务组</summary>
|
||
|
[ProtoMember(4)]
|
||
|
public int[] ChildMissionGroup { get; set; }
|
||
|
/// <summary>触发条件</summary>
|
||
|
[ProtoMember(5)]
|
||
|
public int[] TriggerType { get; set; }
|
||
|
/// <summary>触发条件参数</summary>
|
||
|
[ProtoMember(6)]
|
||
|
public int[] TriggerConditionParameter { get; set; }
|
||
|
/// <summary>其他条件</summary>
|
||
|
[ProtoMember(7)]
|
||
|
public int[] Preconditions { get; set; }
|
||
|
/// <summary>其他条件参数</summary>
|
||
|
[ProtoMember(8)]
|
||
|
public int[] PreconditionsParameter { get; set; }
|
||
|
/// <summary>等级限制</summary>
|
||
|
[ProtoMember(9)]
|
||
|
public int[] LevelLimited { get; set; }
|
||
|
/// <summary>限时类型</summary>
|
||
|
[ProtoMember(10)]
|
||
|
public int TimeLimitType { get; set; }
|
||
|
/// <summary>限时时间</summary>
|
||
|
[ProtoMember(11)]
|
||
|
public int TimeLimit { get; set; }
|
||
|
/// <summary>可放弃</summary>
|
||
|
[ProtoMember(12)]
|
||
|
public int AbleAbandon { get; set; }
|
||
|
/// <summary>接取次数</summary>
|
||
|
[ProtoMember(13)]
|
||
|
public int ReceiveTimes { get; set; }
|
||
|
/// <summary>任务描述</summary>
|
||
|
[ProtoMember(14)]
|
||
|
public string MissionDescription { get; set; }
|
||
|
|
||
|
}
|
||
|
}
|