1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 02:53:29 +08:00
This commit is contained in:
2024-09-18 01:41:08 +08:00
parent fb916b3813
commit bd512a6b78
17 changed files with 232 additions and 207 deletions

View File

@@ -1,6 +1,6 @@
using System.Reflection;
using System;
using System.Reflection;
using BepInEx;
using CheatEnabler.Functions;
using CheatEnabler.Patches;
using HarmonyLib;
using UXAssist.Common;
@@ -83,19 +83,22 @@ public class CheatEnabler : BaseUnityPlugin
"Mecha and Drones/Fleets invincible");
CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false,
"Buildings invincible");
}
private void Start() {
UIConfigWindow.Init();
Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "CheatEnabler.Patches")
.Do(type => type.GetMethod("Init")?.Invoke(null, null));
PlayerFunctions.Init();
DysonSphereFunctions.Init();
_patches = Util.GetTypesFiltered(Assembly.GetExecutingAssembly(),
t => string.Equals(t.Namespace, "CheatEnabler.Patches", StringComparison.Ordinal) || string.Equals(t.Namespace, "CheatEnabler.Functions", StringComparison.Ordinal));
_patches?.Do(type => type.GetMethod("Init")?.Invoke(null, null));
}
private Type[] _patches;
private void Start()
{
_patches?.Do(type => type.GetMethod("Start")?.Invoke(null, null));
}
private void OnDestroy()
{
Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "CheatEnabler.Patches")
.Do(type => type.GetMethod("Uninit")?.Invoke(null, null));
_patches?.Do(type => type.GetMethod("Uninit")?.Invoke(null, null));
}
private void Update()
@@ -103,4 +106,4 @@ public class CheatEnabler : BaseUnityPlugin
if (VFInput.inputing) return;
FactoryPatch.OnUpdate();
}
}
}