public static void Init() { if (Instance == null) { Instance = BeatSaberUI.CreateCustomMenu <CustomMenu>($"{Plugin.instance.Name} has been updated"); CustomViewController middleViewController = BeatSaberUI.CreateViewController <CustomViewController>(); Instance.SetMainViewController(middleViewController, true, (firstActivation, type) => { if (firstActivation) { TMPro.TextMeshProUGUI t = middleViewController.CreateText($"{Plugin.instance.Name} has been updated to v{Plugin.instance.UpdatedVersion}. Restart your game to take effect.", new Vector2(0f, 0f)); t.alignment = TMPro.TextAlignmentOptions.Center; } }); Instance.Present(); if (PluginUI.MultiplayerButton != null) { PluginUI.MultiplayerButton.interactable = false; PluginUI.MultiplayerButton.hintText = "You cannot access multiplayer until you restart your game"; for (int i = PluginUI.MultiplayerButton.buttons.Count - 1; i >= 0; i--) { BeatSaberUI.AddHintText(PluginUI.MultiplayerButton.buttons[i].transform as RectTransform, PluginUI.MultiplayerButton.hintText); } } } }
public static void Init() { if (Instance == null) { Instance = BeatSaberUI.CreateCustomMenu <CustomMenu>("Waiting for players"); middleViewController = BeatSaberUI.CreateViewController <ListViewController>(); Instance.SetMainViewController(middleViewController, true, (firstActivation, type) => { try { if (firstActivation) { level = middleViewController.CreateText("", new Vector2(BASE.x + 40f, BASE.y)); level.alignment = TMPro.TextAlignmentOptions.Center; SteamAPI.SendPlayerPacket(Controllers.PlayerController.Instance._playerInfo); } if (firstInit) { firstInit = false; RefreshData(); } } catch (Exception e) { Logger.Error(e); } }); } }
private new void Start() { base.Start(); _CustomMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Pick a color"); _CustomViewController = BeatSaberUI.CreateViewController <CustomViewController>(); //Console.WriteLine("[BeatSaberCustomUI.ColorPickerPreviewClickable]: ColorPickerPreviewClickable start done."); }
public static void Init() { if (Instance == null) { Instance = BeatSaberUI.CreateCustomMenu <CustomMenu>("Online Multiplayer"); middleViewController = BeatSaberUI.CreateViewController <ListViewController>(); Instance.SetMainViewController(middleViewController, true, (firstActivation, type) => { refreshAvailableLobbies(); if (firstActivation) { middleViewController.CreateText("Available Lobbies", new Vector2(BASE.x + 60f, BASE.y)); refresh = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x + 80f, BASE.y + 2.5f), new Vector2(25f, 7f)); refresh.SetButtonText("Refresh"); refresh.SetButtonTextSize(3f); refresh.ToggleWordWrapping(false); refresh.onClick.AddListener(delegate() { refreshAvailableLobbies(); }); if (!SteamAPI.isLobbyConnected()) { Button host = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f), new Vector2(25f, 7f)); host.SetButtonTextSize(3f); host.ToggleWordWrapping(false); host.onClick.RemoveAllListeners(); host.SetButtonText("Host Public Lobby"); host.onClick.AddListener(delegate() { SteamAPI.CreateLobby(false); Instance.Dismiss(); MultiplayerLobby.Instance.Present(); }); Button hostP = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f - 10f), new Vector2(25f, 7f)); hostP.SetButtonTextSize(3f); hostP.ToggleWordWrapping(false); hostP.onClick.RemoveAllListeners(); hostP.SetButtonText("Host Private Lobby"); hostP.onClick.AddListener(delegate() { SteamAPI.CreateLobby(true); Instance.Dismiss(); MultiplayerLobby.Instance.Present(); }); } } }); } }
internal static void InitRequirementsMenu() { reqDialog = BeatSaberUI.CreateCustomMenu <CustomMenu>("Additional Song Information"); reqViewController = BeatSaberUI.CreateViewController <CustomListViewController>(); RectTransform confirmContainer = new GameObject("CustomListContainer", typeof(RectTransform)).transform as RectTransform; confirmContainer.SetParent(reqViewController.rectTransform, false); confirmContainer.sizeDelta = new Vector2(60f, 0f); GetIcons(); reqDialog.SetMainViewController(reqViewController, true); }
private void _SetupConfirmQuitPanel() { _CustomMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Quit"); _CustomViewController = BeatSaberUI.CreateViewController <CustomViewController>(); if (_CustomMenu != null && _CustomViewController != null) { _CustomViewController.didDeactivateEvent += (deactivationType) => { ConfirmExitDialogOpened = false; }; _CustomMenu.SetMainViewController(_CustomViewController, false, (firstActivation, type) => { if (firstActivation && type == VRUI.VRUIViewController.ActivationType.AddedToHierarchy) { _TopText = _CustomViewController.CreateText(PluginConfig.QuitTextContent, new Vector2(0, 10f), new Vector2(105f, 10)); if (_TopText != null) { _TopText.alignment = TMPro.TextAlignmentOptions.Center; _TopText.fontSize = 6; } else { Console.WriteLine("[BeatSaberCustomExit.MainMenuUIOverload]: 'topText' was null."); } _CancelButton = _CustomViewController.CreateUIButton("CreditsButton", new Vector2(-20f, -20f), new Vector2(30f, 10f), delegate() { _CustomMenu.Dismiss(); }, "Cancel"); _ConfirmButton = _CustomViewController.CreateUIButton("CreditsButton", new Vector2(20, -20f), new Vector2(30f, 10f), delegate() { Plugin.QuitGame(); }, "Quit"); if (_CancelButton != null) { _CancelButton.ToggleWordWrapping(false); } else { Console.WriteLine("[BeatSaberCustomExit.MainMenuUIOverload]: 'buttonCancel' was null."); } if (_ConfirmButton != null) { _ConfirmButton.ToggleWordWrapping(false); } else { Console.WriteLine("[BeatSaberCustomExit.MainMenuUIOverload]: 'buttonConfirm' was null."); } } }); } else { Console.WriteLine("[BeatSaberCustomExit.MainMenuUIOverload]: '_CustomMenu' or '_CustomViewController' was null."); } }
private void InitConfirmationDialog() { _confirmationDialog = BeatSaberUI.CreateCustomMenu <CustomMenu>("Are you sure?"); _confirmationViewController = BeatSaberUI.CreateViewController <CustomViewController>(); RectTransform confirmContainer = new GameObject("CustomListContainer", typeof(RectTransform)).transform as RectTransform; confirmContainer.SetParent(_confirmationViewController.rectTransform, false); confirmContainer.sizeDelta = new Vector2(60f, 0f); // Title text _warningTitle = BeatSaberUI.CreateText(confirmContainer, "", new Vector2(0, 30f)); _warningTitle.fontSize = 9f; _warningTitle.color = Color.red; _warningTitle.alignment = TextAlignmentOptions.Center; _warningTitle.enableWordWrapping = false; // Warning text _warningMessage = BeatSaberUI.CreateText(confirmContainer, "", new Vector2(0, 0)); _warningMessage.rectTransform.sizeDelta = new Vector2(120, 1); _warningMessage.fontSize = 5f; _warningMessage.color = Color.white; _warningMessage.alignment = TextAlignmentOptions.Center; _warningMessage.enableWordWrapping = true; // Yes button _okButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "OkButton")), confirmContainer, false); _okButton.ToggleWordWrapping(false); (_okButton.transform as RectTransform).anchoredPosition = new Vector2(43f, -30f); _okButton.SetButtonText("Yes"); _okButton.onClick.RemoveAllListeners(); _okButton.onClick.AddListener(delegate() { _onConfirm?.Invoke(); _confirmationDialog.Dismiss(); confirmDialogActive = false; }); // No button _cancelButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "OkButton")), confirmContainer, false); _cancelButton.ToggleWordWrapping(false); (_cancelButton.transform as RectTransform).anchoredPosition = new Vector2(18f, -30f); _cancelButton.SetButtonText("No"); _cancelButton.onClick.RemoveAllListeners(); _cancelButton.onClick.AddListener(delegate() { _confirmationDialog.Dismiss(); confirmDialogActive = false; }); _confirmationDialog.SetMainViewController(_confirmationViewController, false); }
private void _SetupDrinkWaterPanel() { if (_CustomMenu != null && _CustomViewController != null) { return; } _CustomMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Drink some cum!"); _CustomViewController = BeatSaberUI.CreateViewController <CustomViewController>(); _CustomViewController.name = "DrinkCumPanel"; if (_CustomMenu != null && _CustomViewController != null) { _CustomMenu.SetMainViewController(_CustomViewController, false, (firstActivation, type) => { if (firstActivation && type == VRUI.VRUIViewController.ActivationType.AddedToHierarchy) { _TextContent = _CustomViewController.CreateText("", new Vector2(0, 28f)); _TextContent.alignment = TextAlignmentOptions.Center; _TextContent.fontSize = 5; _TextContent.enableWordWrapping = false; _ContinueButton = _CustomViewController.CreateUIButton("CreditsButton", new Vector2(0, -28f), new Vector2(37f, 10f), null, "I understand!"); _ContinueButton.ToggleWordWrapping(false); _ContinueButton.SetButtonTextSize(4); _ContinueButton.onClick.AddListener(delegate() { _CustomMenu.Dismiss(); Destroy(_CustomViewController.gameObject, 1); _CustomMenu = null; _CustomViewController = null; }); _RefreshTextContent(_CurrentPanelMode); if (PluginConfig.ShowGIFs) { GameObject go = new GameObject("[BeatSaberDrinkCum] PreviewGif"); _RawImage = go.AddComponent <RawImage>(); _RawImage.material = Instantiate(Resources.FindObjectsOfTypeAll <Material>().Where(m => m.name == "UINoGlow").FirstOrDefault()); go.transform.SetParent(_CustomViewController.transform, false); go.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0); go.GetComponent <RectTransform>().sizeDelta = new Vector2(30, 30); _UniGifImage = go.AddComponent <UniGifImage>(); UniGifImageAspectController ugiac = go.AddComponent <UniGifImageAspectController>(); _UniGifImage.SetPrivateField("m_imgAspectCtrl", ugiac); StartCoroutine(_DisplayGifFromRotation()); } } }); } else { Console.WriteLine("[BeatSaberCustomExit.MainMenuUIOverload]: '_CustomMenu' or '_CustomViewController' was null."); } }
private void RequestQueueControllerMain() { _customMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("QueueButtonOptions"); _customListViewController = BeatSaberUI.CreateViewController <CustomListViewController>(); CreateNextButton(); CreateRandomizeButton(); CreateSongToTopButton(); CreateSubOnlyButton(); CreateClearQueueButton(); CreateBanSongButton(); _customMenu.SetLeftViewController(_customListViewController, true); _customMenu.Present(); }
private void HandleMenuSceneLoadedFresh() { if (_platformMenu == null) { _platformMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Platform Select"); PlatformListViewController platformListViewController = BeatSaberUI.CreateViewController <PlatformListViewController>(); platformListViewController.backButtonPressed += delegate() { _platformMenu.Dismiss(); }; _platformMenu.SetMainViewController(platformListViewController, true); platformListViewController.DidSelectRowEvent += delegate(TableView view, int row) { PlatformManager.Instance.ChangeToPlatform(row); }; } MenuButtonUI.AddButton("Platforms", delegate() { _platformMenu.Present(); }); CreateSettingsUI(); }
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { if (scene.name == "MenuCore") { if (_notesMenu == null) { _notesMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Custom Notes"); UI.NoteListViewController noteListViewController = BeatSaberUI.CreateViewController <UI.NoteListViewController>(); noteListViewController.backButtonPressed += delegate() { _notesMenu.Dismiss(); }; _notesMenu.SetMainViewController(noteListViewController, true); noteListViewController.DidSelectRowEvent += delegate(TableView view, int row) { selectedNote = row; }; } CustomUI.MenuButton.MenuButtonUI.AddButton("CustomNotes", delegate() { _notesMenu.Present(); }); } }
internal static void CreateMenu() { if (SaberForgeMenu == null) { SaberForgeMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Saber Forge"); //create views mainViewController = BeatSaberUI.CreateViewController <MainViewController>(); rightViewController = BeatSaberUI.CreateViewController <RightViewController>(); leftViewController = BeatSaberUI.CreateViewController <LeftViewController>(); //set back button mainViewController.backButtonPressed += delegate() { SaberForgeMenu.Dismiss(); }; //set view positions SaberForgeMenu.SetMainViewController(mainViewController, true); SaberForgeMenu.SetRightViewController(rightViewController, false); SaberForgeMenu.SetLeftViewController(leftViewController, false); } if (HelpMenu == null) { HelpMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Saber Forge Help"); HelpMainViewController helpMainViewController = BeatSaberUI.CreateViewController <HelpMainViewController>(); HelpRightViewController helpRightViewController = BeatSaberUI.CreateViewController <HelpRightViewController>(); HelpLeftViewController helpLeftViewController = BeatSaberUI.CreateViewController <HelpLeftViewController>(); //set back button helpMainViewController.backButtonPressed += delegate() { HelpMenu.Dismiss(); rightViewController.ForceSliders(); leftViewController.ForceSliders();; }; //set view positions HelpMenu.SetMainViewController(helpMainViewController, true); HelpMenu.SetRightViewController(helpRightViewController, false); HelpMenu.SetLeftViewController(helpLeftViewController, false); } MenuButtonUI.AddButton("Saber Forge", delegate() { SaberForgeMenu.Present(); rightViewController.ForceSliders(); leftViewController.ForceSliders(); }); }
/// <summary> /// Set up the UI components for the Tag System /// </summary> /// <returns>yields for the Coroutine system</returns> private IEnumerator _SetupUI() { if (!Initialized) { _ButtonTags = new Dictionary <Button, bool>(); _CustomMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Tags"); _CustomViewController = BeatSaberUI.CreateViewController <CustomViewController>(); _TagNames = new string[] { "Flow", "Streams", "Inventive Patterns", "Meme", "Jump Streams", "Beautiful Lighting", "Vision Blocks", "Bad Walls", "Overstated Difficulty", "Ugly", "Useless", "Entertaining", "Impossible" }; _CustomMenu.SetLeftViewController(_CustomViewController, false, (firstActivation, type) => { if (firstActivation && type == VRUI.VRUIViewController.ActivationType.AddedToHierarchy) { _TopTagLabel = _CustomViewController.CreateText("Tags", new Vector2(2f, 32.5f)); _TopTagLabel.fontSize = 5f; _TopTagLabel.alignment = TextAlignmentOptions.Center; _GenerateButtonTags(_CustomViewController, _TagNames, new Vector2(12.5f, 6.25f), new Vector2(0, 12f), new Vector2(10f, 8.5f), 2f); _CloseButton = _CustomViewController.CreateUIButton("CreditsButton", new Vector2(43f, 31.5f), new Vector2(20f, 8f), () => { _CustomMenu.Dismiss(); }, "Close"); _CloseButton.SetButtonTextSize(3f); _CloseButton.ToggleWordWrapping(false); _OKResultButton = _ResultViewController.GetComponentsInChildren <Button>().First(x => x.name == "Ok"); _OKResultButton.onClick.AddListener(_OKResultButtonClicked); } }); yield return(new WaitUntil(() => { return _CustomMenu.Present(false); })); _CustomMenu.Present(); IsInitializing = false; Initialized = true; } }
public static void OnLoad() { _levelSelectionFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); if (_levelSelectionFlowCoordinator) { _levelSelectionNavigationController = _levelSelectionFlowCoordinator.GetPrivateField <DismissableNavigationController>("_navigationController"); } if (_levelSelectionNavigationController) { if (_songRequestMenu == null) { _songRequestMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Song Request Queue"); _songRequestListViewController = BeatSaberUI.CreateViewController <RequestBotListViewController>(); _songRequestMenu.SetMainViewController(_songRequestListViewController, true); } _requestButton = BeatSaberUI.CreateUIButton(_levelSelectionNavigationController.rectTransform, "QuitButton", new Vector2(60f, 36.8f), new Vector2(15.0f, 5.5f), () => { _requestButton.interactable = false; _songRequestMenu.Present(); _requestButton.interactable = true; }, "Song Requests"); _requestButton.gameObject.GetComponentInChildren <TextMeshProUGUI>().enableWordWrapping = false; _requestButton.SetButtonTextSize(2.0f); _requestButton.interactable = FinalRequestQueue.Count > 0; _requestButton.gameObject.GetComponentInChildren <Image>().color = FinalRequestQueue.Count > 0 ? Color.green : Color.red; BeatSaberUI.AddHintText(_requestButton.transform as RectTransform, $"{(!Config.Instance.SongRequestBot ? "To enable the song request bot, look in the Enhanced Twitch Chat settings menu." : "Manage the current request queue")}"); Plugin.Log("Created request button!"); } SongListUtils.Initialize(); if (Instance) { return; } new GameObject("EnhancedTwitchChatRequestBot").AddComponent <RequestBot>(); }
public static void Init() { if (Instance == null) { try { Instance = BeatSaberUI.CreateCustomMenu <CustomMenu>("Multiplayer Lobby"); CustomViewController middleViewController = BeatSaberUI.CreateViewController <CustomViewController>(); ListViewController leftViewController = BeatSaberUI.CreateViewController <ListViewController>(); rightViewController = BeatSaberUI.CreateViewController <TableViewController>(); Instance.SetMainViewController(middleViewController, true, (firstActivation, type) => { if (firstActivation) { try { Button host = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f), new Vector2(25f, 7f)); host.SetButtonTextSize(3f); host.ToggleWordWrapping(false); host.SetButtonText("Disconnect"); host.onClick.AddListener(delegate { try { SteamAPI.Disconnect(); Instance.Dismiss(); MultiplayerListing.Instance.Present(); } catch (Exception e) { Logger.Error(e); } }); float offs = 0; offs += 10f; Button vc = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f - offs), new Vector2(25f, 7f)); vc.SetButtonTextSize(3f); vc.ToggleWordWrapping(false); vc.SetButtonText(VoiceChatWorker.VoipEnabled ? "Disable Voice Chat" : "Enable Voice Chat"); vc.onClick.AddListener(delegate { try { if (!VoiceChatWorker.VoipEnabled) { vc.SetButtonText("Disable Voice Chat"); VoiceChatWorker.VoipEnabled = true; SteamUser.StartVoiceRecording(); } else { vc.SetButtonText("Enable Voice Chat"); VoiceChatWorker.VoipEnabled = false; SteamUser.StopVoiceRecording(); } } catch (Exception e) { Logger.Error(e); } }); offs += 10f; rejoin = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f - offs), new Vector2(25f, 7f)); rejoin.SetButtonTextSize(3f); rejoin.ToggleWordWrapping(false); rejoin.SetButtonText("Re-Join Song"); rejoin.interactable = false; rejoin.onClick.AddListener(delegate { if (SteamAPI.GetLobbyData().Screen == LobbyPacket.SCREEN_TYPE.IN_GAME && SteamAPI.GetLobbyData().CurrentSongOffset > 0f) { WaitingMenu.autoReady = true; WaitingMenu.timeRequestedToLaunch = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); WaitingMenu.Instance.Present(); } }); bodyText = middleViewController.CreateText("You can use Online Lobby in the Main Menu to choose songs for your lobby. \n\nYou can also control all the default Game Modifiers for the lobby through the Online Lobby Menu as well.", new Vector2(0, BASE.y - 10f)); var tt = middleViewController.CreateText("If something goes wrong, click the disconnect button above and just reconnect to the lobby.", new Vector2(0, 0 - BASE.y)); bodyText.alignment = TMPro.TextAlignmentOptions.Center; tt.alignment = TMPro.TextAlignmentOptions.Center; } catch (Exception e) { Logger.Error(e); } } }); Instance.SetLeftViewController(leftViewController, false, (firstActivation, type) => { if (firstActivation) { refreshFriendsList(leftViewController); leftViewController.CreateText("Invite Friends", new Vector2(BASE.x + 62.5f, BASE.y)); Button b = leftViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x + 80f, BASE.y + 2.5f), new Vector2(25f, 7f)); b.SetButtonText("Refresh"); b.SetButtonTextSize(3f); b.ToggleWordWrapping(false); b.onClick.AddListener(delegate() { refreshFriendsList(leftViewController); }); invite = leftViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x + 80f, 0 - BASE.y + 2.5f), new Vector2(25f, 7f)); invite.SetButtonText("Invite"); invite.SetButtonTextSize(3f); invite.ToggleWordWrapping(false); invite.interactable = false; invite.onClick.AddListener(delegate() { if (selectedPlayer > 0) { SteamAPI.InviteUserToLobby(new CSteamID(selectedPlayer)); } }); } }); Instance.SetRightViewController(rightViewController, false, (firstActivation, type) => { if (firstActivation) { rightViewController.CreateText("Lobby Leaderboard", new Vector2(BASE.x + 62.5f, BASE.y)); } RefreshScores(); }); } catch (Exception e) { Logger.Error(e); } } }
public static void Init() { if (Instance == null) { try { Instance = BeatSaberUI.CreateCustomMenu <CustomMenu>("Multiplayer Lobby"); CustomViewController middleViewController = BeatSaberUI.CreateViewController <CustomViewController>(); ListViewController leftViewController = BeatSaberUI.CreateViewController <ListViewController>(); rightViewController = BeatSaberUI.CreateViewController <TableViewController>(); Instance.SetMainViewController(middleViewController, true, (firstActivation, type) => { if (firstActivation) { try { Button host = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f), new Vector2(25f, 7f)); host.SetButtonTextSize(3f); host.ToggleWordWrapping(false); host.SetButtonText("Disconnect"); host.onClick.AddListener(delegate { try { SteamAPI.Disconnect(); Instance.Dismiss(); MultiplayerListing.Instance.Present(); } catch (Exception e) { Logger.Error(e); } }); float offs = 0; offs += 10f; Button vc = middleViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x, BASE.y + 2.5f - offs), new Vector2(25f, 7f)); vc.SetButtonTextSize(3f); vc.ToggleWordWrapping(false); vc.SetButtonText(Controllers.PlayerController.Instance.VoipEnabled ? "Disable Voice Chat" : "Enable Voice Chat"); vc.onClick.AddListener(delegate { try { if (!Controllers.PlayerController.Instance.VoipEnabled) { vc.SetButtonText("Disable Voice Chat"); Controllers.PlayerController.Instance.VoipEnabled = true; SteamUser.StartVoiceRecording(); } else { vc.SetButtonText("Enable Voice Chat"); Controllers.PlayerController.Instance.VoipEnabled = false; SteamUser.StopVoiceRecording(); } } catch (Exception e) { Logger.Error(e); } }); var t = middleViewController.CreateText("You can use Online Lobby in the Main Menu to choose songs for your lobby. \n\nYou can also control all the default Game Modifiers for the lobby through the Online Lobby Menu as well.", new Vector2(0, BASE.y - 10f)); var tt = middleViewController.CreateText("If something goes wrong, click the disconnect button above and just reconnect to the lobby.", new Vector2(0, 0 - BASE.y)); t.alignment = TMPro.TextAlignmentOptions.Center; tt.alignment = TMPro.TextAlignmentOptions.Center; } catch (Exception e) { Data.Logger.Error(e); } /* Button g = middleViewController.CreateUIButton("CreditsButton", new Vector2(0, 0), new Vector2(25f, 25f)); * g.SetButtonTextSize(7f); * g.ToggleWordWrapping(false); * g.SetButtonText("Select a Song"); * g.onClick.AddListener(delegate { * try * { * if (SteamAPI.IsHost()) * { * SteamAPI.SetSong("112D7FA45FA06F36FF41029099E95B98", "TaKillYa"); * SteamAPI.SetDifficulty((byte)2); * SteamAPI.RequestPlay(new GameplayModifiers(new GameplayModifiers())); * } * } * catch (Exception e) * { * Logger.Error(e); * } * });*/ } }); Instance.SetLeftViewController(leftViewController, false, (firstActivation, type) => { if (firstActivation) { refreshFriendsList(leftViewController); leftViewController.CreateText("Invite Friends", new Vector2(BASE.x + 62.5f, BASE.y)); Button b = leftViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x + 80f, BASE.y + 2.5f), new Vector2(25f, 7f)); b.SetButtonText("Refresh"); b.SetButtonTextSize(3f); b.ToggleWordWrapping(false); b.onClick.AddListener(delegate() { refreshFriendsList(leftViewController); }); invite = leftViewController.CreateUIButton("CreditsButton", new Vector2(BASE.x + 80f, 0 - BASE.y + 2.5f), new Vector2(25f, 7f)); invite.SetButtonText("Invite"); invite.SetButtonTextSize(3f); invite.ToggleWordWrapping(false); invite.interactable = false; invite.onClick.AddListener(delegate() { if (selectedPlayer > 0) { SteamAPI.InviteUserToLobby(new CSteamID(selectedPlayer)); } }); } }); Instance.SetRightViewController(rightViewController, false, (active, type) => { if (active) { rightViewController.CreateText("Lobby Leaderboard", new Vector2(BASE.x + 62.5f, BASE.y)); } RefreshScores(); }); } catch (Exception e) { Data.Logger.Error(e); } } }
public static void OnLoad() { try { var _levelListViewController = Resources.FindObjectsOfTypeAll <LevelPackLevelsViewController>().First(); if (_levelListViewController) { _requestButton = BeatSaberUI.CreateUIButton(_levelListViewController.rectTransform, "OkButton", new Vector2(66, -3.5f), new Vector2(9f, 5.5f), () => { _requestButton.interactable = false; _songRequestMenu.Present(); _requestButton.interactable = true; }, "SRM"); (_requestButton.transform as RectTransform).anchorMin = new Vector2(1, 1); (_requestButton.transform as RectTransform).anchorMax = new Vector2(1, 1); _requestButton.ToggleWordWrapping(false); _requestButton.SetButtonTextSize(3.5f); BeatSaberUI.AddHintText(_requestButton.transform as RectTransform, "Manage the current request queue"); UpdateRequestUI(); Plugin.Log("Created request button!"); } } catch { Plugin.Log("Unable to create request button"); } if (_songRequestListViewController == null) { _songRequestListViewController = BeatSaberUI.CreateViewController <RequestBotListViewController>(); } if (_KeyboardViewController == null) { _KeyboardViewController = BeatSaberUI.CreateViewController <CustomViewController>(); RectTransform KeyboardContainer = new GameObject("KeyboardContainer", typeof(RectTransform)).transform as RectTransform; KeyboardContainer.SetParent(_KeyboardViewController.rectTransform, false); KeyboardContainer.sizeDelta = new Vector2(60f, 40f); var mykeyboard = new KEYBOARD(KeyboardContainer, ""); #if UNRELEASED //mykeyboard.AddKeys(BOTKEYS, 0.4f); AddKeyboard(mykeyboard, "emotes.kbd", 0.4f); #endif mykeyboard.AddKeys(KEYBOARD.QWERTY); // You can replace this with DVORAK if you like mykeyboard.DefaultActions(); #if UNRELEASED const string SEARCH = @" [CLEAR SEARCH]/0 /2 [NEWEST]/0 /2 [UNFILTERED]/30 /2 [PP]/0'!addsongs/top/pp pp%CR%' /2 [SEARCH]/0"; #else const string SEARCH = @" [CLEAR SEARCH]/0 /2 [NEWEST]/0 /2 [UNFILTERED]/30 /2 [SEARCH]/0"; #endif mykeyboard.SetButtonType("OkButton"); // Adding this alters button positions??! Why? mykeyboard.AddKeys(SEARCH, 0.75f); mykeyboard.SetAction("CLEAR SEARCH", ClearSearch); mykeyboard.SetAction("UNFILTERED", UnfilteredSearch); mykeyboard.SetAction("SEARCH", MSD); mykeyboard.SetAction("NEWEST", Newest); #if UNRELEASED AddKeyboard(mykeyboard, "decks.kbd", 0.4f); #endif // The UI for this might need a bit of work. AddKeyboard(mykeyboard, "RightPanel.kbd"); } if (_songRequestMenu == null) { _songRequestMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Song Request Queue"); _songRequestMenu.SetMainViewController(_songRequestListViewController, true); _songRequestMenu.SetRightViewController(_KeyboardViewController, false); } SongListUtils.Initialize(); WriteQueueSummaryToFile(); WriteQueueStatusToFile(QueueMessage(RequestBotConfig.Instance.RequestQueueOpen)); // Yes, this is disabled on purpose. StreamCore will init this class for you now, so don't uncomment this! -Brian //if (Instance) return; //new GameObject("SongRequestManager").AddComponent<RequestBot>(); }
private new void Start() { base.Start(); _CustomMenu = BeatSaberUI.CreateCustomMenu <CustomMenu>("Pick a color"); _CustomViewController = BeatSaberUI.CreateViewController <CustomViewController>(); }