This repository was archived by the owner on Jul 8, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathYongAnFramePlugin.cs
More file actions
63 lines (59 loc) · 2.73 KB
/
Copy pathYongAnFramePlugin.cs
File metadata and controls
63 lines (59 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Exiled.API.Enums;
using Exiled.API.Features;
using HarmonyLib;
using System;
using YongAnFrame.Features;
using YongAnFrame.Features.Players;
using YongAnFrame.Features.Roles;
using YongAnFrame.Patch;
namespace YongAnFrame
{
/// <summary>
/// 插件的驱动
/// </summary>
public sealed class YongAnFramePlugin : Plugin<Config, Translation>
{
private static YongAnFramePlugin? instance;
/// <summary>
/// 获取<seealso cref="YongAnFramePlugin"/>单例
/// </summary>
public static YongAnFramePlugin Instance
{
get
{
if (instance is null)
{
throw new InvalidCastException("YongAnFramePlugin实例无效");
}
return instance;
}
}
/// <summary>
/// 获取<seealso cref="HarmonyLib.Harmony"/>实例
/// </summary>
public Harmony Harmony { get; } = new Harmony("YongAnFrame.Harmony");
///<inheritdoc/>
public override PluginPriority Priority => PluginPriority.Higher;
///<inheritdoc/>
public override void OnEnabled()
{
instance = this;
Log.Info("\r\n __ __ ______ __ __ ______ ______ __ __ \r\n/\\ \\_\\ \\ /\\ __ \\ /\\ \"-.\\ \\ /\\ ___\\ /\\ __ \\ /\\ \"-.\\ \\ \r\n\\ \\____ \\ \\ \\ \\/\\ \\ \\ \\ \\-. \\ \\ \\ \\__ \\ \\ \\ __ \\ \\ \\ \\-. \\ \r\n \\/\\_____\\ \\ \\_____\\ \\ \\_\\\\\"\\_\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\\\\"\\_\\ \r\n \\/_____/ \\/_____/ \\/_/ \\/_/ \\/_____/ \\/_/\\/_/ \\/_/ \\/_/ \r\n \r\n ______ ______ ______ __ __ ______ \r\n/\\ ___\\ /\\ == \\ /\\ __ \\ /\\ \"-./ \\ /\\ ___\\ \r\n\\ \\ __\\ \\ \\ __< \\ \\ __ \\ \\ \\ \\-./\\ \\ \\ \\ __\\ \r\n \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_\\ \\ \\_____\\ \r\n \\/_/ \\/_/ /_/ \\/_/\\/_/ \\/_/ \\/_/ \\/_____/ \r\n \r\n ");
PathManager.CheckPath();
FramePlayer.SubscribeStaticEvents();
CustomRolePlus.SubscribeStaticEvents();
AddLogPatch.StartTask();
Harmony.PatchAll();
base.OnEnabled();
}
///<inheritdoc/>
public override void OnDisabled()
{
instance = null;
FramePlayer.UnsubscribeStaticEvents();
CustomRolePlus.UnsubscribeStaticEvents();
Harmony.UnpatchAll();
base.OnDisabled();
}
}
}