From 37f00568b4e125533108af379ed497c746f8d22a Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 23 Feb 2023 20:42:23 +0000 Subject: [PATCH] Move the colour button I forgot this existed (It doesn't look great with all of the buttons stacked in a row like this, so I'll probably come back later and make it look better.) --- JollyRebind/modinfo.json | 2 +- src/JollyMenuKeybinds.cs | 9 +++++++++ src/JollyRebindMod.cs | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/JollyRebind/modinfo.json b/JollyRebind/modinfo.json index 2def040..ca8a007 100644 --- a/JollyRebind/modinfo.json +++ b/JollyRebind/modinfo.json @@ -1,7 +1,7 @@ { "id": "sabreml.jollyrebind", "name": "Jolly Rebind", - "version": "1.0.0", + "version": "1.0.1", "target_game_version": "v1.9.06", "authors": "SabreML", "description": "Adds a customisable input to change the Jolly Co-op pointing button.", diff --git a/src/JollyMenuKeybinds.cs b/src/JollyMenuKeybinds.cs index 8ad80ab..a9e6efa 100644 --- a/src/JollyMenuKeybinds.cs +++ b/src/JollyMenuKeybinds.cs @@ -25,6 +25,7 @@ public static void SetupHooks() On.JollyCoop.JollyMenu.JollyPlayerSelector.ctor += JollyPlayerSelectorHK; On.JollyCoop.JollyMenu.JollyPlayerSelector.Update += JollyPlayerSelector_UpdateHK; + On.JollyCoop.JollyMenu.JollyPlayerSelector.AddColorButton += JollyPlayerSelector_AddColorButtonHK; new ILHook( typeof(OpKeyBinder).GetProperty("value", BindingFlags.Public | BindingFlags.Instance).GetSetMethod(), @@ -110,6 +111,14 @@ private static void JollyPlayerSelector_UpdateHK(On.JollyCoop.JollyMenu.JollyPla keybindWrappers[self.index].ThisConfig.greyedOut = !self.Joined; } + private static void JollyPlayerSelector_AddColorButtonHK(On.JollyCoop.JollyMenu.JollyPlayerSelector.orig_AddColorButton orig, JollyPlayerSelector self) + { + orig(self); + self.colorConfig.pos.y -= keybindWrappers[self.index].thisElement.size.y; + self.colorConfig.lastPos.y -= keybindWrappers[self.index].thisElement.size.y; + } + + // Adds a check to the setter of `OpKeyBinder.value` to stop it from playing a sound before the menu is fully loaded. // This is needed because otherwise all four keybind buttons will try to play a sound at the same time when the menu opens, resulting in a loud noise. private static void OpKeyBinder_set_value(ILContext il) diff --git a/src/JollyRebindMod.cs b/src/JollyRebindMod.cs index 198edaf..4ae3d69 100644 --- a/src/JollyRebindMod.cs +++ b/src/JollyRebindMod.cs @@ -8,7 +8,7 @@ namespace JollyRebind { - [BepInPlugin("sabreml.jollyrebind", "JollyRebind", "1.0.0")] + [BepInPlugin("sabreml.jollyrebind", "JollyRebind", "1.0.1")] public class JollyRebindMod : BaseUnityPlugin { public void OnEnable()