Added 2 selections overload

This commit is contained in:
David Higueros committed 2026-07-12 22:28:11 -06:00
1 parent 4fb9897cc6
commit 54f594f947
2 files changed
+27

No files matched your search

+13
View File
@@ -111,6 +111,19 @@ public abstract class CustomMultiSelectMenu<TEntry>(IntPtr il2CppPtr)
Begin(entries, list => onClick(list?[0]), 1, false);
}
/// <summary>
/// Begins/opens the custom menu, requiring two selections.
/// </summary>
/// <param name="entries">All entries to give the custom menu.</param>
/// <param name="onClick">Function called when both selections are made.</param>
/// <param name="shouldConfirm">Wheter the set of both selections should be confirmed manually.</param>
/// <param name="canRepeat">If the same entry can be selected both times, else unselect entry on click.</param>
[HideFromIl2Cpp]
protected void Begin(IEnumerable<TEntry> entries, Action<TEntry?, TEntry?> onClick, bool shouldConfirm, bool canRepeat = false)
{
Begin(entries, list => onClick(list?[0], list?[1]), 2, shouldConfirm, canRepeat);
}
private void OnEntryClick(TEntry entry, Action<List<TEntry>> onClick)
{
MenuEntry menuEntry = MenuEntries.First(e => e.Entry == entry);
+14
View File
@@ -43,6 +43,20 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : CustomMultiSelectMenu<PlayerCo
potentialVictims = EntryPanels;
}
/// <summary>
/// Begins/opens the custom player menu.
/// </summary>
/// <param name="playerMatch">Function to determine if player should show in the custom menu.</param>
/// <param name="onClick"><see cref="PassiveButton.OnClick"/> action for the two-player selection.</param>
/// <param name="shouldConfirm">Wheter the set of both selections should be confirmed manually.</param>
/// <param name="canRepeat">If the same entry can be selected both times, else unselect entry on click.</param>
[HideFromIl2Cpp]
public void Begin(Func<PlayerControl, bool> playerMatch, Action<PlayerControl?, PlayerControl?> 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;