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 MonsterConfigCategory : ProtoObject, IMerge
|
||
|
{
|
||
|
public static MonsterConfigCategory Instance;
|
||
|
|
||
|
[ProtoIgnore]
|
||
|
[BsonIgnore]
|
||
|
private Dictionary<int, MonsterConfig> dict = new Dictionary<int, MonsterConfig>();
|
||
|
|
||
|
[BsonElement]
|
||
|
[ProtoMember(1)]
|
||
|
private List<MonsterConfig> list = new List<MonsterConfig>();
|
||
|
|
||
|
public MonsterConfigCategory()
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
|
||
|
public void Merge(object o)
|
||
|
{
|
||
|
MonsterConfigCategory s = o as MonsterConfigCategory;
|
||
|
this.list.AddRange(s.list);
|
||
|
}
|
||
|
|
||
|
public override void EndInit()
|
||
|
{
|
||
|
foreach (MonsterConfig config in list)
|
||
|
{
|
||
|
config.EndInit();
|
||
|
this.dict.Add(config.Id, config);
|
||
|
}
|
||
|
this.AfterEndInit();
|
||
|
}
|
||
|
|
||
|
public MonsterConfig Get(int id)
|
||
|
{
|
||
|
this.dict.TryGetValue(id, out MonsterConfig item);
|
||
|
|
||
|
if (item == null)
|
||
|
{
|
||
|
throw new Exception($"配置找不到,配置表名: {nameof (MonsterConfig)},配置id: {id}");
|
||
|
}
|
||
|
|
||
|
return item;
|
||
|
}
|
||
|
|
||
|
public bool Contain(int id)
|
||
|
{
|
||
|
return this.dict.ContainsKey(id);
|
||
|
}
|
||
|
|
||
|
public Dictionary<int, MonsterConfig> GetAll()
|
||
|
{
|
||
|
return this.dict;
|
||
|
}
|
||
|
|
||
|
public List<MonsterConfig> GetList()
|
||
|
{
|
||
|
return this.list;
|
||
|
}
|
||
|
|
||
|
public MonsterConfig GetOne()
|
||
|
{
|
||
|
if (this.dict == null || this.dict.Count <= 0)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
return this.dict.Values.GetEnumerator().Current;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[ProtoContract]
|
||
|
public partial class MonsterConfig: 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 LV { get; set; }
|
||
|
/// <summary>生命</summary>
|
||
|
[ProtoMember(4)]
|
||
|
public int HP { get; set; }
|
||
|
/// <summary>攻击</summary>
|
||
|
[ProtoMember(5)]
|
||
|
public int ATK { get; set; }
|
||
|
/// <summary>防御</summary>
|
||
|
[ProtoMember(6)]
|
||
|
public int DEF { get; set; }
|
||
|
/// <summary>攻击速度</summary>
|
||
|
[ProtoMember(7)]
|
||
|
public int AttackSpeed { get; set; }
|
||
|
/// <summary>命中率</summary>
|
||
|
[ProtoMember(8)]
|
||
|
public int HitRate { get; set; }
|
||
|
/// <summary>招架率</summary>
|
||
|
[ProtoMember(9)]
|
||
|
public int ParryRate { get; set; }
|
||
|
/// <summary>闪避率</summary>
|
||
|
[ProtoMember(10)]
|
||
|
public int DodgeRate { get; set; }
|
||
|
/// <summary>移动速度</summary>
|
||
|
[ProtoMember(11)]
|
||
|
public int MoveSpeed { get; set; }
|
||
|
/// <summary>使用武器</summary>
|
||
|
[ProtoMember(12)]
|
||
|
public int Weapon { get; set; }
|
||
|
/// <summary>无武器普通攻击</summary>
|
||
|
[ProtoMember(13)]
|
||
|
public int UnarmedAttack { get; set; }
|
||
|
/// <summary>普通攻击</summary>
|
||
|
[ProtoMember(14)]
|
||
|
public int NormalAttack { get; set; }
|
||
|
/// <summary>技能</summary>
|
||
|
[ProtoMember(15)]
|
||
|
public int SkillSet { get; set; }
|
||
|
/// <summary>经验产出</summary>
|
||
|
[ProtoMember(16)]
|
||
|
public int EXP { get; set; }
|
||
|
/// <summary>修为产出</summary>
|
||
|
[ProtoMember(17)]
|
||
|
public int Sophisticate { get; set; }
|
||
|
/// <summary>物品掉落</summary>
|
||
|
[ProtoMember(18)]
|
||
|
public int DropGroup { get; set; }
|
||
|
|
||
|
}
|
||
|
}
|