mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 02:53:29 +08:00
WIP
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user