public IEnumerator ControlWizard(int playerNumber, OptionsMenuButton button) { VirtualControlManager.SetupDefaultControls(playerNumber); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); foreach (string inputName in VirtualControlManager.inputNames) { cInput.ChangeKey(inputName + playerNumber); button.text.text = string.Format("Press key/button for {0}", inputName); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); yield return(new WaitUntil(() => !cInput.scanning)); } button.text.text = "Set controls for player " + (playerNumber + 1); }
//wait a bit, else LaunchPanel is null public static IEnumerator AddLaunchPanelButtons() { yield return(new WaitForSeconds(.6f)); LaunchPanel lp = GameObject.FindObjectOfType <LaunchPanel>(); launchButton = lp.songPreviewButton; CreateLaunchPanelButtons(); }
public static void CreateSettingsButton(OptionsMenu optionsMenu) { string toggleText = "OFF"; if (config.activated) { toggleText = "ON"; } optionsMenu.AddHeader(0, "Trippy Menu"); toggleButton = optionsMenu.AddButton (0, toggleText, new Action(() => { if (config.activated) { config.activated = false; playPsychadelia = false; toggleButton.label.text = "OFF"; SaveConfig(); GameplayModifiers.I.mPsychedeliaPhase = 0.00000001f; timer = 0; } else { config.activated = true; playPsychadelia = true; toggleButton.label.text = "ON"; SaveConfig(); } }), null, "Turns Trippy Menu on or off"); speedSlider = optionsMenu.AddSlider ( 0, "Trippy Menu Cycle Speed", "P", new Action <float>((float n) => { config.speed = Mathf.Round((config.speed + n) * 1000.0f) / 1000.0f; UpdateSlider(speedSlider, "Speed : " + config.speed.ToString()); }), null, null, "Changes color cycle speed" ); speedSlider.label.text = "Speed : " + config.speed.ToString(); //MelonModLogger.Log("Buttons created"); menuSpawned = true; }
private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Marathon Settings"); optionsMenu.scrollable.AddRow(header); string shuffleText = Config.Shuffle ? "<color=\"green\">Shuffle ON" : "<color=\"red\">Shuffle OFF"; shuffleButton = optionsMenu.AddButton(0, shuffleText, new Action(() => { ToggleShuffle(); }), null, "Shuffles the songs", optionsMenu.buttonPrefab); string showScoreText = Config.ShowScores ? "<color=\"green\">Show Score ON" : "<color=\"red\">Show Score OFF"; showScoreButton = optionsMenu.AddButton(1, showScoreText, new Action(() => { ToggleShowScore(); }), null, "Shows 'Level Complete' at the end of each song", optionsMenu.buttonPrefab); string noFailText = Config.NoFail ? "<color=\"green\">NoFail ON" : "<color=\"red\">NoFail OFF"; noFailButton = optionsMenu.AddButton(0, noFailText, new Action(() => { ToggleNoFail(); }), null, "Play the marathon with NoFail on or off", optionsMenu.buttonPrefab); string resetHealthText = Config.ResetHealth ? "<color=\"green\">Reset Health ON" : "<color=\"red\">Reset Health OFF"; resetHealthButton = optionsMenu.AddButton(1, resetHealthText, new Action(() => { ToggleResetHealth(); }), null, "Reset Health at the end of each song", optionsMenu.buttonPrefab); Il2CppSystem.Collections.Generic.List <GameObject> toggles = new Il2CppSystem.Collections.Generic.List <GameObject>(); toggles.Add(shuffleButton.gameObject); toggles.Add(showScoreButton.gameObject); optionsMenu.scrollable.AddRow(toggles); toggles.Clear(); toggles.Add(noFailButton.gameObject); toggles.Add(resetHealthButton.gameObject); optionsMenu.scrollable.AddRow(toggles); var divider = optionsMenu.AddHeader(0, ""); optionsMenu.scrollable.AddRow(divider); var start = optionsMenu.AddButton(1, "Start", new Action(() => { MelonPreferences.Save(); PlaylistEndlessManager.StartEndlessSession(); }), null, "Starts the marathon", optionsMenu.buttonPrefab); optionsMenu.scrollable.AddRow(start.gameObject); }
public static void AddModPageToModMenu(ModPage modPage) { int buttonCol = 0; foreach (EntryType entryType in modPage.entryType) { switch (entryType) { case EntryType.Header: optionsMenu.AddHeader(0, modPage.headers[0]); modPage.headers.RemoveAt(0); buttonCol = 0; break; case EntryType.Button: ModButton b = modPage.buttons[0]; OptionsMenuButton omb = optionsMenu.AddButton(buttonCol, b.label, new System.Action(() => { b.onSelectedDelegate.Invoke(); }), null, b.helpText); omb.label.text = b.initialButtonText; modPage.buttons.RemoveAt(0); if (buttonCol == 0) { buttonCol = 1; } else { buttonCol = 0; } break; case EntryType.Slider: ModSlider s = modPage.sliders[0]; OptionsMenuSlider oms = optionsMenu.AddSlider(buttonCol, s.label, s.numberFormat, s.onAdjustAction, null); oms.label.text = s.initialSliderText; modPage.sliders.RemoveAt(0); if (buttonCol == 0) { buttonCol = 1; } else { buttonCol = 0; } break; default: break; } } }
OptionsMenuButton CreateButton(string defaultText, UnityAction action, TextUpdate textUpdate) { OptionsMenuButton b = Instantiate(buttonPrefab, menuContent); b.text.text = defaultText; b.button.onClick.AddListener(action); if (textUpdate != null) { b.button.onClick.AddListener(delegate { b.text.text = textUpdate(); Debug.Log(textUpdate()); }); } b.transform.ResetTransform(); return(b); }
public void PlayerControlMenu(int playerNumber) { ClearMenu(); foreach (string inputName in VirtualControlManager.inputNames) { OptionsMenuButton b = CreateButton(InputNameText(inputName, playerNumber), delegate { cInput.ChangeKey(inputName + playerNumber); }); b.alwaysUpdateTitle = true; b.textUpdate = delegate { return(InputNameText(inputName, playerNumber)); }; } //OptionsMenuButton b = CreateButton("Set Controls for Player "+(playerNumber+1), delegate { }); //b.button.onClick.AddListener( delegate { SetControlsForPlayer(playerNumber, b); } ); //CreateButton("Reset All Controls", delegate { cInput.ResetInputs(); PlayerControlMenu(playerNumber); }); CreateButton("Back", ControlsMenu); }
private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Search by: Artist, Title, Mapper"); optionsMenu.scrollable.AddRow(header); var searchField = optionsMenu.AddButton(0, "Search:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Filter by: Artist, Title, Mapper", optionsMenu.textEntryButtonPrefab); optionsMenu.scrollable.AddRow(searchField.gameObject); searchText = searchField.gameObject.GetComponentInChildren <TextMeshPro>(); var infoText = optionsMenu.AddTextBlock(0, "Searching for nothing will find all songs, unless limited by additional filters."); optionsMenu.scrollable.AddRow(infoText); var filtersHeader = optionsMenu.AddHeader(0, "Additional filters"); optionsMenu.scrollable.AddRow(filtersHeader); mapTypeToggle = optionsMenu.AddButton(0, SplitCamelCase(SongSearch.mapType.ToString()), new Action(() => { SongSearch.mapType++; if ((int)SongSearch.mapType > 2) { SongSearch.mapType = SongSearch.MapType.All; } mapTypeToggle.label.text = SplitCamelCase(SongSearch.mapType.ToString()); }), null, "Filters the search to the selected map type"); mapTypeToggle.button.doMeshExplosion = false; mapTypeToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(mapTypeToggle.gameObject); }
private static void AddButtons(OptionsMenu optionsMenu) { /*var header = optionsMenu.AddHeader(0, "Playlists"); * optionsMenu.scrollable.AddRow(header);*/ OptionsMenuButton entry = null; foreach (string playlist in PlaylistManager.playlists.Keys) { var name = optionsMenu.AddTextBlock(0, playlist); var tmp = name.transform.GetChild(0).GetComponent <TextMeshPro>(); tmp.fontSizeMax = 32; tmp.fontSizeMin = 8; optionsMenu.scrollable.AddRow(name.gameObject); OptionsMenuButton edit = null; if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting) { edit = optionsMenu.AddButton(0, "Edit", new Action(() => { PlaylistManager.state = PlaylistManager.PlaylistState.Editing; PlaylistManager.SetPlaylistToEdit(playlist); OptionsMenu.I.ShowPage(OptionsMenu.Page.Misc); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Edit this playlist", optionsMenu.buttonPrefab); } string txt = PlaylistManager.state == PlaylistManager.PlaylistState.Selecting ? "Select" : "Add"; entry = optionsMenu.AddButton(1, txt, new Action(() => { if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting) { PlaylistManager.SelectPlaylist(playlist); } else { PlaylistManager.AddSongToPlaylist(playlist, AddPlaylistButton.songToAdd); MenuState.I.GoToLaunchPage(); return; } PlaylistManager.state = PlaylistManager.PlaylistState.None; FilterPanel.ResetFilterState(); MenuState.I.GoToSongPage(); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Select this playlist", optionsMenu.buttonPrefab); Il2CppSystem.Collections.Generic.List <GameObject> row = new Il2CppSystem.Collections.Generic.List <GameObject>(); //row.Add(name.gameObject); if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting) { row.Add(edit.gameObject); } row.Add(entry.gameObject); optionsMenu.scrollable.AddRow(row); } var header = optionsMenu.AddHeader(0, "Create"); optionsMenu.scrollable.AddRow(header); entry = optionsMenu.AddButton(0, "Create new Playlist", new Action(() => { MelonLoader.MelonLogger.Msg("Create button shot"); PlaylistManager.state = PlaylistManager.PlaylistState.Creating; OptionsMenu.I.ShowPage(OptionsMenu.Page.Misc); MenuState.I.GoToSettingsPage(); SelectPlaylistButton.UpdatePlaylistButton(); }), null, "Create a new playlist", optionsMenu.buttonPrefab); optionsMenu.scrollable.AddRow(entry.gameObject); }
public static void Postfix() { OptionsMenuButton.HudUpdate(); KeySelector.HudUpdate(); PopUpWindow.HudUpdate(); }
private static void AddButtons(OptionsMenu optionsMenu) { var header = optionsMenu.AddHeader(0, "Filter by: Artist, Title, Mapper"); optionsMenu.scrollable.AddRow(header); var searchField = optionsMenu.AddButton(0, "Search:", new Action(() => { SongBrowser.shouldShowKeyboard = true; optionsMenu.keyboard.Show(); }), null, "Filter by: Artist, Title, Mapper", optionsMenu.textEntryButtonPrefab); optionsMenu.scrollable.AddRow(searchField.gameObject); searchText = searchField.gameObject.GetComponentInChildren <TextMeshPro>(); var difficultyHeader = optionsMenu.AddHeader(0, "Filter difficulty"); optionsMenu.scrollable.AddRow(difficultyHeader); string difficultyFilterText = difficultyFilter.ToString(); difficultyToggle = optionsMenu.AddButton (0, difficultyFilterText, new Action(() => { difficultyFilter++; if ((int)difficultyFilter > 4) { difficultyFilter = 0; } difficultyToggle.label.text = difficultyFilter.ToString(); SongBrowser.page = 1; SongBrowser.StartSongSearch(); }), null, "Filters the search to the selected difficulty"); difficultyToggle.button.doMeshExplosion = false; difficultyToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(difficultyToggle.gameObject); var extraHeader = optionsMenu.AddHeader(0, "Extra"); optionsMenu.scrollable.AddRow(extraHeader); string curatedFilterText = "Curated only: " + curated.ToString(); curatedToggle = optionsMenu.AddButton (0, curatedFilterText, new Action(() => { if (curated) { curated = false; } else { curated = true; } curatedToggle.label.text = "Curated only: " + curated.ToString(); SongBrowser.page = 1; SongBrowser.StartSongSearch(); }), null, "Filters the search to curated maps only"); curatedToggle.button.doMeshExplosion = false; curatedToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(curatedToggle.gameObject); var downloadFullPage = optionsMenu.AddButton (1, "Download current page", new Action(() => { DownloadFullPage(); }), null, "Downloads all songs from the current page, this will cause major stutters"); var RestoreSongs = optionsMenu.AddButton (0, "Restore Deleted Songs", new Action(() => { SongBrowser.RestoreDeletedSongs(); }), null, "Restores all the songs you have deleted."); //optionsMenu.scrollable.AddRow(RestoreSongs.gameObject); string popularityFilterText = "Sort by playcount: " + popularity.ToString(); popularityToggle = optionsMenu.AddButton (1, popularityFilterText, new Action(() => { if (popularity) { popularity = false; } else { popularity = true; } popularityToggle.label.text = "Sort by playcount: " + popularity.ToString(); SongBrowser.page = 1; SongBrowser.StartSongSearch(); }), null, "Sorts downloads by leaderboard scores rather than date."); popularityToggle.button.doMeshExplosion = false; popularityToggle.button.doParticles = false; optionsMenu.scrollable.AddRow(popularityToggle.gameObject); var downloadFolderBlock = optionsMenu.AddTextBlock(0, "You can hotload songs by placing them in Audica/Downloads and pressing F5"); optionsMenu.scrollable.AddRow(downloadFolderBlock); }
public override void OnUpdate() { if (MenuState.sState == 0) { return; } if (introSkip) { if (!isPlaying && MenuState.sState == MenuState.State.Launched && AudioDriver.I is AudioDriver) { isPlaying = true; } else if (isPlaying && (MenuState.sState != MenuState.State.Launched || AudioDriver.I is null)) { isPlaying = false; introSkipped = false; } if (isPlaying) { if (!skipQueued && !introSkipped && GetCurrentTick() < GetFirstTick() - 3840) { canSkip = true; if (popup is null) { if (button == "") { switch (VRHardwareSetup.I.hardware) { case VRHardwareSetup.VRHardwareMode.Cosmos: button = "X"; break; case VRHardwareSetup.VRHardwareMode.Knuckles: case VRHardwareSetup.VRHardwareMode.OculusNative: case VRHardwareSetup.VRHardwareMode.OculusOpenVR: button = "A"; break; case VRHardwareSetup.VRHardwareMode.ViveWand: case VRHardwareSetup.VRHardwareMode.WinMROpenVR: button = "R Menu Button"; break; case VRHardwareSetup.VRHardwareMode.Unknown: button = "?"; break; } } popup = KataConfig.I.CreateDebugText("Skip Intro by pressing <color=#85e359>" + button + "</color>", new Vector3(0f, -1f, 5f), 3f, null, false, 0.001f).gameObject; } } else { if (canSkip) { canSkip = false; } if (popup is GameObject) { GameObject.Destroy(popup); popup = null; } } } } if (MenuState.sState == MenuState.State.Launched) { return; } if (MenuState.sState != MenuState.State.SettingsPage) { miscPageFound = false; } if (MenuState.sState == MenuState.State.SettingsPage && !miscPageFound) { if (OptionsMenu.I is OptionsMenu) { optionMenu = OptionsMenu.I; } else { return; } if (optionMenu.mPage == OptionsMenu.Page.Misc) { miscPageFound = true; } if (miscPageFound && !menuSpawned) { if (optionMenu.mPage == OptionsMenu.Page.Misc) { string toggleText = "OFF"; if (introSkip) { toggleText = "ON"; } optionMenu.AddHeader(0, "Skip Intro"); toggleButton = optionMenu.AddButton (0, toggleText, new Action(() => { if (introSkip) { introSkip = false; toggleButton.label.text = "OFF"; SaveConfig(); } else { introSkip = true; toggleButton.label.text = "ON"; SaveConfig(); } }), null, "Enables Intro Skipping"); menuSpawned = true; } } else if (!miscPageFound) { menuSpawned = false; } } }
public static void CreateLaunchPanelButtons() { #region Grind Button if (!grindButtonCreated) { grindModeButton = UnityEngine.Object.Instantiate(launchButton); grindModeButton.transform.localScale = launchPanelButtonScale; UnityEngine.Object.Destroy(grindModeButton.transform.root.GetComponentInChildren <Localizer>()); TextMeshPro grindButtontext = grindModeButton.transform.root.GetComponentInChildren <TextMeshPro>(); grindButtontext.text = grindMode ? "GrindMode ON" : "GrindMode OFF"; grindModeButton.SelectedAction = null; grindModeButton.IsChecked = null; grindModeButton.SelectedAction = new Action(() => { grindMode = !grindMode; string txt = grindMode ? "ON" : "OFF"; allowedMissCountButton.gameObject.SetActive(grindMode && !Config.highscoreMode); grindModeButton.label.text = "Grind Mode " + txt; }); grindModeButton.transform.position = new Vector3(0, 13.2f, 24.19168f); grindButtonCreated = true; } #endregion #region Auto Skip Button if (!autoSkipButtonCreated) { autoSkipButton = UnityEngine.Object.Instantiate(launchButton); autoSkipButton.transform.localScale = launchPanelButtonScale; UnityEngine.Object.Destroy(autoSkipButton.transform.root.GetComponentInChildren <Localizer>()); TextMeshPro autoSkipButtonText = autoSkipButton.transform.root.GetComponentInChildren <TextMeshPro>(); autoSkipButtonText.text = Config.autoSkip ? "AutoSkip ON" : "AutoSkip OFF"; autoSkipButton.SelectedAction = null; autoSkipButton.IsChecked = null; autoSkipButton.SelectedAction = new Action(() => { Config.autoSkip = !Config.autoSkip; Config.Save(); string txt = "Auto Skip " + (Config.autoSkip ? "ON" : "OFF"); autoSkipButton.label.text = txt; }); autoSkipButton.transform.position = new Vector3(-7.317519f, 13.2f, 24.19168f); autoSkipButtonCreated = true; } #endregion #region Miss Count Button if (!allowedMissCountButtonCreated) { allowedMissCountButton = UnityEngine.Object.Instantiate(launchButton); allowedMissCountButton.transform.localScale = launchPanelButtonScale; UnityEngine.Object.Destroy(allowedMissCountButton.transform.root.GetComponentInChildren <Localizer>()); TextMeshPro missCountButtonText = allowedMissCountButton.transform.root.GetComponentInChildren <TextMeshPro>(); missCountButtonText.text = "Allowed misses: " + Config.allowedMissCount.ToString(); allowedMissCountButton.SelectedAction = null; allowedMissCountButton.IsChecked = null; allowedMissCountButton.SelectedAction = new Action(() => { Config.allowedMissCount += 1; Config.Save(); if (Config.allowedMissCount > 10) { Config.allowedMissCount = 0; } string txt = "Allowed Misses: " + Config.allowedMissCount.ToString(); allowedMissCountButton.label.text = txt; }); allowedMissCountButton.transform.position = new Vector3(7.317519f, 13.2f, 24.19168f); allowedMissCountButton.gameObject.SetActive(false); allowedMissCountButtonCreated = true; } #endregion #region Behavior Button if (!behaviorButtonCreated) { behaviorButton = UnityEngine.Object.Instantiate(launchButton); behaviorButton.transform.localScale = launchPanelButtonScale; UnityEngine.Object.Destroy(behaviorButton.transform.root.GetComponentInChildren <Localizer>()); TextMeshPro behaviorButtonText = behaviorButton.transform.root.GetComponentInChildren <TextMeshPro>(); behaviorButtonText.text = Config.highscoreMode ? "Mode: Highscore" : "Mode: Standard"; behaviorButton.SelectedAction = null; behaviorButton.IsChecked = null; behaviorButton.SelectedAction = new Action(() => { Config.highscoreMode = !Config.highscoreMode; Config.Save(); MelonLogger.Log(Config.highscoreMode.ToString()); string txt = Config.highscoreMode ? "Mode: Highscore" : "Mode: Standard"; allowedMissCountButton.gameObject.SetActive(!Config.highscoreMode && grindMode); behaviorButton.label.text = txt; }); behaviorButton.transform.position = new Vector3(0, 15.2f, 24.19168f); behaviorButtonCreated = true; } #endregion #region Instant Restart Button if (!instantRestartButtonCreated) { instantRestartButton = UnityEngine.Object.Instantiate(launchButton); instantRestartButton.transform.localScale = launchPanelButtonScale; UnityEngine.Object.Destroy(instantRestartButton.transform.root.GetComponentInChildren <Localizer>()); TextMeshPro instantSkipButtonText = instantRestartButton.transform.root.GetComponentInChildren <TextMeshPro>(); instantSkipButtonText.text = Config.showStats ? "Show Stats ON" : "Show Stats OFF"; instantRestartButton.SelectedAction = null; instantRestartButton.IsChecked = null; instantRestartButton.SelectedAction = new Action(() => { Config.showStats = !Config.showStats; Config.Save(); string txt = "Show Stats " + (Config.showStats ? "ON" : "OFF"); instantRestartButton.label.text = txt; }); instantRestartButton.transform.position = new Vector3(-7.317519f, 15.2f, 24.19168f); instantRestartButtonCreated = true; } #endregion SetLaunchPanelButtonsActive(true); }
public void SetControlsForPlayer(int player, OptionsMenuButton button) { StartCoroutine(ControlWizard(player, button)); }