public static void AddQuickMenuButton(VRCEUiQuickButton button) { if (!_UIInitialized) { return; } OnQuickMenuButtonAdd?.Invoke(button); }
private static void _QuickMenuButtonAdded(VRCEUiQuickButton button) { _quickMenuMoreMenu.AddButton(button); if (_quickMenuMoreMenu.HasButtons) { _quickMenuMoreButton.Control.gameObject.SetActive(true); } else { _quickMenuMoreButton.Control.gameObject.SetActive(false); } }
public static VRCEUiQuickButton AddQuickMenuButton(string name, string text, string tooltip, Action clickAction) { if (!_UIInitialized) { return(null); } VRCEUiQuickButton button = new VRCEUiQuickButton(name, new Vector2(0f, 0f), text, tooltip); button.OnClick += clickAction; OnQuickMenuButtonAdd?.Invoke(button); return(button); }
private static IEnumerator SetupQuickMenu() { // Run UI checks while (VRCEUi.QuickMenu == null) { yield return(null); } // Get QuickMenu defaults Vector2 quickMenuButtonPos = VRCEUi.InternalQuickMenu.ReportWorldButton.GetComponent <RectTransform>().localPosition; // Load QuickMenu UI MVRCLogger.Log("Loading QuickMenu UI..."); _quickMenuMoreMenu = new VRCEUiQuickScrollMenu("MoreMenu", false); _quickMenuMoreButton = new VRCEUiQuickButton("MoreButton", new Vector2(quickMenuButtonPos.x, quickMenuButtonPos.y + 840f), "More", "Shows more Quick Menu buttons that mods have added.", VRCEUi.InternalQuickMenu.ShortcutMenu); _quickMenuMoreButton.Control.gameObject.SetActive(_quickMenuMoreMenu.HasButtons); _quickMenuMoreButton.OnClick += () => { if (VRCEUi.InternalQuickMenu.CurrentPage == null) { return; } ShowQuickMenuPage(_quickMenuMoreMenu.Control); }; _quickMenuLessButton = new VRCEUiQuickButton("LessButton", new Vector2(quickMenuButtonPos.x, quickMenuButtonPos.y + 420f), "Less", "Takes you back to the main Quick Menu screen.", _quickMenuMoreMenu.Control); _quickMenuLessButton.OnClick += () => { if (VRCEUi.QuickMenu == null) { return; } VRCEUi.QuickMenu.SetMenuIndex(0); }; MVRCLogger.Log("QuickMenu UI has been loaded!"); }