This repository was archived by the owner on Feb 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.cs
More file actions
63 lines (54 loc) · 2.19 KB
/
Copy pathPlugin.cs
File metadata and controls
63 lines (54 loc) · 2.19 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 cwiz.ext;
using System;
using System.IO;
using System.Linq;
using BepInEx;
namespace cwiz {
using BDF = BepInDependency.DependencyFlags;
// using static cwiz.MainConfig;
[BepInPlugin(PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInProcess("Human.exe")]
[BepInDependency("com.plcc.hff.timer", BDF.SoftDependency)]
[BepInDependency("com.plcc.hff.humanmod", BDF.SoftDependency)]
[BepInDependency("org.bepinex.plugins.humanfallflat.achievements", BDF.SoftDependency)]
[BepInDependency("org.bepinex.plugins.humanfallflat.objectgrabber", BDF.SoftDependency)]
public partial class Plugin : BaseUnityPlugin {
public const string PLUGIN_GUID = "com.kirisoup.hff.cwiz";
public static readonly string dir = Path.Combine(Paths.ConfigPath, "ConfigWizard");
private static readonly ShellRegist.SCommand _cmd = new(
"cwiz",
"ConfigWizard command. Modify the files and use `reload` or `r` to reload configs.",
new Action<string>(input => (
(input?
.Trim()
.Split(' ')
.Select(s => s.Trim())
.ToArray()
?? string.Empty
.Single()
.ToArray())
.ToTuple(a => a.Length, a => a[0]) switch {
(1, string s) => s switch {
"reload" or "r" => new Action(() =>
CwizManager.ApplyAll()
),
_ => null
},
_ => null
} ?? new Action(() => Shell.Print(ShellRegist.Help("cwiz", true)))
)())
);
public static Plugin instance;
public void Awake() {
instance = this;
if (!MasterConfig.enabled) return;
if (MasterConfig.applyByCommand) _cmd.Reg();
if (MasterConfig.applyOnAwake) CwizManager.ApplyAll();
if (MasterConfig.applyOnWrite) CwizManager.ApplyOnWrite(true);
}
public void OnDestroy() {
_cmd.Destroy();
CwizManager.ApplyOnWrite(false);
}
}
}