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