mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Fix null component errors for custom multi menu
This commit is contained in:
1 parent
9f0cf11ba1
commit
0cb0527ddf
3 files changed
+41
-1
No files matched your search
@@ -69,9 +69,10 @@ public abstract class CustomMultiSelectMenu<TEntry> : CustomPhoneMenu<CustomMult
|
|||||||
|
|
||||||
customMenu.confirmButton = null!; // TODO: create/add confirm button
|
customMenu.confirmButton = null!; // TODO: create/add confirm button
|
||||||
|
|
||||||
|
/*
|
||||||
var button = customMenu.confirmButton.GetComponent<PassiveButton>();
|
var button = customMenu.confirmButton.GetComponent<PassiveButton>();
|
||||||
button.OnClick.RemoveAllListeners();
|
button.OnClick.RemoveAllListeners();
|
||||||
button.OnClick.AddListener((UnityAction)customMenu.OnCompleteSelection);
|
button.OnClick.AddListener((UnityAction)customMenu.OnCompleteSelection);*/
|
||||||
|
|
||||||
customMenu.activeColor = activeColor;
|
customMenu.activeColor = activeColor;
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,14 @@ public abstract class CustomPhoneMenu : ICustomMenu
|
|||||||
Component.Close();
|
Component.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Forcibly closes the menu.
|
||||||
|
/// </summary>
|
||||||
|
public void ForceClose()
|
||||||
|
{
|
||||||
|
Component.ForceClose();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <typeparamref name="TMenu"/>.
|
/// Creates a <typeparamref name="TMenu"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using MiraAPI.Utilities.Assets;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace MiraAPI.Hud;
|
namespace MiraAPI.Hud;
|
||||||
@@ -28,6 +29,36 @@ public class CustomPlayerMenu : CustomMultiSelectMenu<PlayerControl>
|
|||||||
return Create<CustomPlayerMenu>();
|
return Create<CustomPlayerMenu>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="CustomPlayerMenu"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>New <see cref="CustomPlayerMenu"/> object.</returns>
|
||||||
|
/// <param name="activeColor">The <see cref="Color"/> to use when an entry is selected but not hovered over.</param>
|
||||||
|
/// <param name="hoverSelectSprite">The <see cref="Sprite"/> to use when an entry is hovered over while not selected.</param>
|
||||||
|
/// <param name="hoverSelectColor">The <see cref="Color"/> to use when an entry is hovered over while not selected.</param>
|
||||||
|
/// <param name="hoverDeselectSprite">The <see cref="Sprite"/> to use when an entry is hovered over while selected.</param>
|
||||||
|
/// <param name="hoverDeselectColor">The <see cref="Color"/> to use when an entry is hovered over while selected.</param>
|
||||||
|
/// <param name="onMouseOut">Function that can optionally be run when the mouse is moved outside a menu panel.</param>
|
||||||
|
/// <param name="onMouseOver">Function that can optionally be run when the mouse is moved over a menu panel.</param>
|
||||||
|
public static CustomPlayerMenu Create(
|
||||||
|
Color? activeColor,
|
||||||
|
LoadableAsset<Sprite>? hoverSelectSprite = null,
|
||||||
|
Color? hoverSelectColor = null,
|
||||||
|
LoadableAsset<Sprite>? hoverDeselectSprite = null,
|
||||||
|
Color? hoverDeselectColor = null,
|
||||||
|
PanelButtonOnMouse? onMouseOut = null,
|
||||||
|
PanelButtonOnMouse? onMouseOver = null)
|
||||||
|
{
|
||||||
|
return Create<CustomPlayerMenu>(
|
||||||
|
activeColor,
|
||||||
|
hoverSelectSprite,
|
||||||
|
hoverSelectColor,
|
||||||
|
hoverDeselectSprite,
|
||||||
|
hoverDeselectColor,
|
||||||
|
onMouseOut,
|
||||||
|
onMouseOver);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Begins/opens the custom player menu.
|
/// Begins/opens the custom player menu.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in new issue
Block a user