Skip to content

Commit

Permalink
fix button issue
Browse files Browse the repository at this point in the history
  • Loading branch information
XtraCube committed Aug 27, 2024
1 parent 05fdf53 commit 6bc6ab7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion MiraAPI/Hud/CustomActionButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using MiraAPI.Utilities.Assets;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace MiraAPI.Hud;

Expand Down Expand Up @@ -95,7 +96,7 @@ internal void CreateButton(Transform parent)
}

var pb = Button.GetComponent<PassiveButton>();
pb.OnClick.RemoveAllListeners();
pb.OnClick = new Button.ButtonClickedEvent();
pb.OnClick.AddListener((UnityAction)ClickHandler);
}

Expand Down
4 changes: 2 additions & 2 deletions MiraAPI/Patches/PlayerControlPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static void PlayerControlFixedUpdatePostfix(PlayerControl __instance)

foreach (var button in CustomButtonManager.CustomButtons)
{
if (__instance.Data?.Role != null)
if (__instance.Data?.Role == null)
{
return;
continue;
}

if (!button.Enabled(__instance.Data?.Role))
Expand Down

0 comments on commit 6bc6ab7

Please sign in to comment.