From 16dcf732b3417a5404a5b7e61ba949b2779c2e30 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Mon, 22 Aug 2022 01:44:43 +0800 Subject: [PATCH] initial commit --- DSP_Mods.sln | 16 ++++++++++++ DevShortcuts/DevShortcuts.cs | 44 ++++++++++++++++++++++++++++++++ DevShortcuts/DevShortcuts.csproj | 24 +++++++++++++++++ NuGet.Config | 6 +++++ 4 files changed, 90 insertions(+) create mode 100644 DSP_Mods.sln create mode 100644 DevShortcuts/DevShortcuts.cs create mode 100644 DevShortcuts/DevShortcuts.csproj create mode 100644 NuGet.Config diff --git a/DSP_Mods.sln b/DSP_Mods.sln new file mode 100644 index 0000000..2d6644d --- /dev/null +++ b/DSP_Mods.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevShortcuts", "DevShortcuts\DevShortcuts.csproj", "{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/DevShortcuts/DevShortcuts.cs b/DevShortcuts/DevShortcuts.cs new file mode 100644 index 0000000..d0634ae --- /dev/null +++ b/DevShortcuts/DevShortcuts.cs @@ -0,0 +1,44 @@ +using BepInEx; +using HarmonyLib; + +namespace DevShortcuts +{ + [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] + public class DevShortcuts : BaseUnityPlugin + { + private void Awake() + { + // Plugin startup logic + Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!"); + } + + private void Start() + { + Harmony.CreateAndPatchAll(typeof(DevShortcuts)); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(PlayerController), "Init")] + static void PlayerControllerInit(ref PlayerAction[] ___actions, Player ___player) + { + var cnt = ___actions.Length; + var newActions = new PlayerAction[cnt + 1]; + for (int i = 0; i < cnt; i++) + { + newActions[i] = ___actions[i]; + } + var test = new PlayerAction_Test(); + test.Init(___player); + newActions[cnt] = test; + ___actions = null; + ___actions = newActions; + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(PlayerAction_Test), "GameTick")] + static void PlayerAction_TestGameTick(PlayerAction_Test __instance, long timei) + { + __instance.Update(); + } + } +} diff --git a/DevShortcuts/DevShortcuts.csproj b/DevShortcuts/DevShortcuts.csproj new file mode 100644 index 0000000..3eda80a --- /dev/null +++ b/DevShortcuts/DevShortcuts.csproj @@ -0,0 +1,24 @@ + + + + netstandard2.0 + DevShortcuts + org.soardev.devshortcuts + DSP MOD - DevShortcuts + 1.0.0 + true + latest + + + + + + + + + + + + + + diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..1864ded --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file