Skip to content

Commit

Permalink
Move the colour button
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
SabreML committed Feb 23, 2023
1 parent 5fd02b4 commit 37f0056
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion JollyRebind/modinfo.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
9 changes: 9 additions & 0 deletions src/JollyMenuKeybinds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/JollyRebindMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 37f0056

Please sign in to comment.