milimoe 7b4a655ff4
添加CharacterMode,SkillMode,ItemMode类和其它杂项 (#64)
* 添加CharacterMode,SkillMode,ItemMode

* 添加默认地图属性

* 添加CharacterMode, SkillMode, ItemMode的Loader方法,优化构造函数

* 添加和优化Equals方法

* 删除Symbol
2023-11-30 00:27:49 +08:00

76 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Interface;
namespace Milimoe.FunGame.Core.Library.Common.Addon
{
public abstract class SkillMode : IAddon
{
/// <summary>
/// 模组名称
/// </summary>
public abstract string Name { get; }
/// <summary>
/// 模组描述
/// </summary>
public abstract string Description { get; }
/// <summary>
/// 模组版本
/// </summary>
public abstract string Version { get; }
/// <summary>
/// 模组作者
/// </summary>
public abstract string Author { get; }
/// <summary>
/// 此模组中包含的技能
/// </summary>
public abstract List<Skill> Skills { get; }
/// <summary>
/// 加载标记
/// </summary>
private bool IsLoaded = false;
/// <summary>
/// 加载模组
/// </summary>
public bool Load(params object[] objs)
{
if (IsLoaded)
{
return false;
}
// BeforeLoad可以阻止加载此模组
if (BeforeLoad())
{
// 模组加载后,不允许再次加载此模组
IsLoaded = true;
// 如果加载后需要执行代码请重写AfterLoad方法
AfterLoad();
}
return IsLoaded;
}
/// <summary>
/// 模组加载后需要做的事
/// </summary>
protected virtual void AfterLoad()
{
// override
}
/// <summary>
/// 允许返回false来阻止加载此模组
/// </summary>
/// <returns></returns>
protected virtual bool BeforeLoad()
{
return true;
}
}
}