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