diff --git a/MiraAPI/Hud/CustomMultiSelectMenu.cs b/MiraAPI/Hud/CustomMultiSelectMenu.cs index 5fd597c..3383bd1 100644 --- a/MiraAPI/Hud/CustomMultiSelectMenu.cs +++ b/MiraAPI/Hud/CustomMultiSelectMenu.cs @@ -111,6 +111,19 @@ public abstract class CustomMultiSelectMenu(IntPtr il2CppPtr) Begin(entries, list => onClick(list?[0]), 1, false); } + /// + /// Begins/opens the custom menu, requiring two selections. + /// + /// All entries to give the custom menu. + /// Function called when both selections are made. + /// Wheter the set of both selections should be confirmed manually. + /// If the same entry can be selected both times, else unselect entry on click. + [HideFromIl2Cpp] + protected void Begin(IEnumerable entries, Action onClick, bool shouldConfirm, bool canRepeat = false) + { + Begin(entries, list => onClick(list?[0], list?[1]), 2, shouldConfirm, canRepeat); + } + private void OnEntryClick(TEntry entry, Action> onClick) { MenuEntry menuEntry = MenuEntries.First(e => e.Entry == entry); diff --git a/MiraAPI/Hud/CustomPlayerMenu.cs b/MiraAPI/Hud/CustomPlayerMenu.cs index b060631..59e2803 100644 --- a/MiraAPI/Hud/CustomPlayerMenu.cs +++ b/MiraAPI/Hud/CustomPlayerMenu.cs @@ -43,6 +43,20 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : CustomMultiSelectMenu + /// Begins/opens the custom player menu. + /// + /// Function to determine if player should show in the custom menu. + /// action for the two-player selection. + /// Wheter the set of both selections should be confirmed manually. + /// If the same entry can be selected both times, else unselect entry on click. + [HideFromIl2Cpp] + public void Begin(Func playerMatch, Action onClick, bool shouldConfirm = false, bool canRepeat = false) + { + Begin(PlayerControl.AllPlayerControls.ToArray().Where(playerMatch), onClick, shouldConfirm, canRepeat); + potentialVictims = EntryPanels; + } + protected override void SetupPanelEntry(ShapeshifterPanel panel, int i, PlayerControl player, Action onClick) { var flag = PlayerControl.LocalPlayer.Data.Role.NameColor == player.Data.Role.NameColor;