mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Revert "forgot shapeshifter's menu is a minigame itself"
This reverts commit f62513a3b4.
This commit is contained in:
1 file changed
+23
-2
@@ -12,6 +12,22 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace MiraAPI.Hud;
|
||||
|
||||
/// <summary>
|
||||
/// Component registered in Il2Cpp domain to handle Unity events for custom menus.
|
||||
/// </summary>
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an entry in a <see cref="CustomPhoneMenu"/> with a Panel.
|
||||
/// </summary>
|
||||
@@ -94,7 +110,7 @@ public abstract class CustomPhoneMenu : ICustomMenu
|
||||
/// <summary>
|
||||
/// Gets the wrapped component that the menu modifies.
|
||||
/// </summary>
|
||||
public ShapeshifterMinigame Component { get; internal set; } = null!;
|
||||
public CustomPhoneMenuComponent Component { get; internal set; } = null!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<IMenuEntry> MenuEntries { get; protected set; } = [];
|
||||
@@ -155,9 +171,10 @@ public abstract class CustomPhoneMenu : ICustomMenu
|
||||
|
||||
var ogMenu = shapeShifterRole.TryCast<ShapeshifterRole>()!.ShapeshifterMenu;
|
||||
var newMenu = Object.Instantiate(ogMenu);
|
||||
var component = newMenu.gameObject.AddComponent<CustomPhoneMenuComponent>();
|
||||
var customMenu = new TMenu
|
||||
{
|
||||
Component = newMenu,
|
||||
Component = component,
|
||||
panelPrefab = newMenu.PanelPrefab,
|
||||
xStart = newMenu.XStart,
|
||||
yStart = newMenu.YStart,
|
||||
@@ -171,6 +188,10 @@ 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);
|
||||
|
||||
Reference in new issue
Block a user