From 0cb0527ddfe491379a2de020bab98c35703490d4 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 19 Sep 2026 13:18:36 -0500 Subject: [PATCH] Fix null component errors for custom multi menu --- MiraAPI/Hud/CustomMultiSelectMenu.cs | 3 ++- MiraAPI/Hud/CustomPhoneMenu.cs | 8 +++++++ MiraAPI/Hud/CustomPlayerMenu.cs | 31 ++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/MiraAPI/Hud/CustomMultiSelectMenu.cs b/MiraAPI/Hud/CustomMultiSelectMenu.cs index 0e87ade..c57ad8b 100644 --- a/MiraAPI/Hud/CustomMultiSelectMenu.cs +++ b/MiraAPI/Hud/CustomMultiSelectMenu.cs @@ -69,9 +69,10 @@ public abstract class CustomMultiSelectMenu : CustomPhoneMenu(); button.OnClick.RemoveAllListeners(); - button.OnClick.AddListener((UnityAction)customMenu.OnCompleteSelection); + button.OnClick.AddListener((UnityAction)customMenu.OnCompleteSelection);*/ customMenu.activeColor = activeColor; diff --git a/MiraAPI/Hud/CustomPhoneMenu.cs b/MiraAPI/Hud/CustomPhoneMenu.cs index 38edd89..a632798 100644 --- a/MiraAPI/Hud/CustomPhoneMenu.cs +++ b/MiraAPI/Hud/CustomPhoneMenu.cs @@ -169,6 +169,14 @@ public abstract class CustomPhoneMenu : ICustomMenu Component.Close(); } + /// + /// Forcibly closes the menu. + /// + public void ForceClose() + { + Component.ForceClose(); + } + /// /// Creates a . /// diff --git a/MiraAPI/Hud/CustomPlayerMenu.cs b/MiraAPI/Hud/CustomPlayerMenu.cs index a0b57a2..26c3b94 100644 --- a/MiraAPI/Hud/CustomPlayerMenu.cs +++ b/MiraAPI/Hud/CustomPlayerMenu.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using MiraAPI.Utilities.Assets; using UnityEngine; namespace MiraAPI.Hud; @@ -28,6 +29,36 @@ public class CustomPlayerMenu : CustomMultiSelectMenu return Create(); } + /// + /// Creates a . + /// + /// New object. + /// 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. + public static CustomPlayerMenu Create( + Color? activeColor, + LoadableAsset? hoverSelectSprite = null, + Color? hoverSelectColor = null, + LoadableAsset? hoverDeselectSprite = null, + Color? hoverDeselectColor = null, + PanelButtonOnMouse? onMouseOut = null, + PanelButtonOnMouse? onMouseOver = null) + { + return Create( + activeColor, + hoverSelectSprite, + hoverSelectColor, + hoverDeselectSprite, + hoverDeselectColor, + onMouseOut, + onMouseOver); + } + /// /// Begins/opens the custom player menu. ///