diff --git a/MiraAPI/Hud/CustomPhoneMenu.cs b/MiraAPI/Hud/CustomPhoneMenu.cs index 51f508f..8873aac 100644 --- a/MiraAPI/Hud/CustomPhoneMenu.cs +++ b/MiraAPI/Hud/CustomPhoneMenu.cs @@ -12,22 +12,6 @@ using Object = UnityEngine.Object; namespace MiraAPI.Hud; -/// -/// Component registered in Il2Cpp domain to handle Unity events for custom menus. -/// -[RegisterInIl2Cpp] -public class CustomPhoneMenuComponent(IntPtr cppPtr) : Minigame(cppPtr) -{ - [SuppressMessage("Style", "IDE0051:Remove unused private members", Justification = "Unity convention.")] - private void OnDisable() - { - if (ControllerManager.Instance) - { - ControllerManager.Instance.CloseOverlayMenu(name); - } - } -} - /// /// Defines an entry in a with a Panel. /// @@ -110,7 +94,7 @@ public abstract class CustomPhoneMenu : ICustomMenu /// /// Gets the wrapped component that the menu modifies. /// - public CustomPhoneMenuComponent Component { get; internal set; } = null!; + public ShapeshifterMinigame Component { get; internal set; } = null!; /// public List MenuEntries { get; protected set; } = []; @@ -171,10 +155,9 @@ public abstract class CustomPhoneMenu : ICustomMenu var ogMenu = shapeShifterRole.TryCast()!.ShapeshifterMenu; var newMenu = Object.Instantiate(ogMenu); - var component = newMenu.gameObject.AddComponent(); var customMenu = new TMenu { - Component = component, + Component = newMenu, panelPrefab = newMenu.PanelPrefab, xStart = newMenu.XStart, yStart = newMenu.YStart, @@ -188,10 +171,6 @@ public abstract class CustomPhoneMenu : ICustomMenu back.OnClick.RemoveAllListeners(); back.OnClick.AddListener((UnityAction)customMenu.Close); - component.CloseSound = newMenu.CloseSound; - component.logger = newMenu.logger; - component.OpenSound = newMenu.OpenSound; - newMenu.DestroyImmediate(); customMenu.transform.SetParent(Camera.main!.transform, false);