diff --git a/MiraAPI/Hud/CustomMultiSelectMenu.cs b/MiraAPI/Hud/CustomMultiSelectMenu.cs index 21b4998..8f829cb 100644 --- a/MiraAPI/Hud/CustomMultiSelectMenu.cs +++ b/MiraAPI/Hud/CustomMultiSelectMenu.cs @@ -41,6 +41,18 @@ public abstract class CustomMultiSelectMenu(IntPtr il2CppPtr) public record MenuEntry(ShapeshifterPanel Panel, TEntry Entry) : IMenuEntry; + /// + /// Creates a . + /// + /// The type of . + /// The to use when an entry is selected but not hovered over. + /// The to use when an entry is hovered over while not selected. + /// The to use when an entry is hovered over while not selected. + /// The to use when an entry is hovered over while selected. + /// The to use when an entry is hovered over while selected. + /// Function that can optionally be run when the mouse is moved outside a menu panel. + /// Function that can optionally be run when the mouse is moved over a menu panel. + /// New object. protected static TMenu Create( Color? activeColor = null, LoadableAsset? hoverSelectSprite = null, @@ -70,6 +82,13 @@ public abstract class CustomMultiSelectMenu(IntPtr il2CppPtr) return customMenu; } + /// + /// Setup the given once created, given its index, entry, and onClick action. + /// + /// The panel to configure. + /// The 's index. + /// The 's entry. + /// Action to perform when the is clicked on. protected abstract void SetupPanelEntry(ShapeshifterPanel panel, int i, TEntry entry, Action onClick); /// @@ -172,11 +191,15 @@ public abstract class CustomMultiSelectMenu(IntPtr il2CppPtr) onSelection!(selectedEntries.Select(se => se.Entry).ToList()); } + /// protected override bool IsEntrySelected(IMenuEntry entry) { return selectedEntries.Any(e => e.Panel == entry.Panel); } + /// + /// + /// Whether the menu entry is actively selected. [HideFromIl2Cpp] protected void SetNameplateAppearance(IMenuEntry menuEntry, bool isSelected) { diff --git a/MiraAPI/Hud/CustomPhoneMenu.cs b/MiraAPI/Hud/CustomPhoneMenu.cs index bf85b8e..29677b7 100644 --- a/MiraAPI/Hud/CustomPhoneMenu.cs +++ b/MiraAPI/Hud/CustomPhoneMenu.cs @@ -152,6 +152,14 @@ public abstract class CustomPhoneMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr), I } #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member + /// + /// Register new menu panels given a set of entries. + /// + /// The type of the entry. + /// The entries to create panels for. + /// Function to configure the menu's panel once created, given its index and entry. + /// Function to create a for a given panel and it's entry. + /// If , it will create s, acting as wrappers for the s. protected void RegisterPanels( IEnumerable entries, Action entryPanelConfig, @@ -196,6 +204,12 @@ public abstract class CustomPhoneMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr), I } } + /// + /// + /// Action to perform when a given entry is clicked on. + /// Argument will be if the back button was clicked instead. + /// Function to configure the menu's panel once created, given its index, entry, and onClick action. + /// protected void RegisterPanels( IEnumerable entries, Action onEntryClick, @@ -205,8 +219,20 @@ public abstract class CustomPhoneMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr), I RegisterPanels(entries, (p, i, e) => entryPanelConfig(p, i, e, () => onEntryClick(e)), menuEntryMaker); } + /// + /// Determines if a given entry is currently selected, not just hovered over. + /// + /// The to check. + /// if the is selected, else . protected virtual bool IsEntrySelected(IMenuEntry entry) => false; + /// + /// Set the icon, over color, and unselected color for a given entry. + /// + /// The menu entry. + /// The to use as the icon, if any. + /// The to use when hovering over an entry. + /// The to use when not hovering over an entry. [HideFromIl2Cpp] protected static void SetNameplateAppearance( IMenuEntry menuEntry, LoadableAsset? sprite, Color? overColor, Color? unselectedColor) diff --git a/MiraAPI/Hud/CustomPlayerMenu.cs b/MiraAPI/Hud/CustomPlayerMenu.cs index 3da194b..80a231f 100644 --- a/MiraAPI/Hud/CustomPlayerMenu.cs +++ b/MiraAPI/Hud/CustomPlayerMenu.cs @@ -58,6 +58,7 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : CustomMultiSelectMenu protected override void SetupPanelEntry(ShapeshifterPanel panel, int i, PlayerControl player, Action onClick) { var flag = PlayerControl.LocalPlayer.Data.Role.NameColor == player.Data.Role.NameColor;