private static bool Prefix(KeyboardEntry __instance, KeyCode keyCode, string label) { if (SongBrowser.shouldShowKeyboard) { switch (label) { case "done": __instance.Hide(); SongBrowser.shouldShowKeyboard = false; SongBrowser.page = 1; SongBrowser.StartSongSearch(); break; case "clear": SongBrowser.searchString = ""; break; default: SongBrowser.searchString += label; break; } if (SongDownloaderUI.searchText != null) { SongDownloaderUI.searchText.text = SongBrowser.searchString; } return(false); } else { return(true); } }
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); }
private static void AddPageButtons(OptionsMenu optionsMenu) { var row = new Il2CppSystem.Collections.Generic.List <GameObject>(); var previousPage = optionsMenu.AddButton(0, "Previous Page", new Action(() => { SongBrowser.PreviousPage(); SongBrowser.StartSongSearch(); optionsMenu.scrollable.SnapTo(0); }), null, null); row.Add(previousPage.gameObject); var nextPage = optionsMenu.AddButton(1, "Next Page", new Action(() => { SongBrowser.NextPage(); SongBrowser.StartSongSearch(); optionsMenu.scrollable.SnapTo(0); }), null, null); row.Add(nextPage.gameObject); optionsMenu.scrollable.AddRow(row); }