private static IEnumerator PostProcess() { MapperNames.FixMappers(); yield return(null); if (SongBrowser.songDataLoaderInstalled) { SafeDataLoaderReload(); } yield return(null); // calculate song difficulties // only slow the first time this runs since results are cached songIDs.Clear(); songFilenames.Clear(); songDictionary.Clear(); for (int i = 0; i < SongList.I.songs.Count; i++) { string songID = SongList.I.songs[i].songID; songIDs.Add(songID); string path = Path.GetFileName(SongList.I.songs[i].zipPath); songFilenames.Add(path); songDictionary.Add(path, songID); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Easy.ToString()); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Normal.ToString()); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Hard.ToString()); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Expert.ToString()); yield return(null); } SongSearch.Search(); // update the search results with any new songs (if there is a search) yield return(null); foreach (Action cb in postProcessingActions) { cb(); yield return(null); } KataConfig.I.CreateDebugText("Songs Loaded", new Vector3(0f, -1f, 5f), 5f, null, false, 0.2f); EnableButtons(); searching = false; yield return(null); }
private static bool Prefix(OptionsMenu __instance) { // should always be on the search page when this happens if (SongSearch.searchInProgress) { SongSearch.CancelSearch(); return(false); } else if (PlaylistManager.state == PlaylistManager.PlaylistState.Selecting || PlaylistManager.state == PlaylistManager.PlaylistState.Adding) { PlaylistSelectPanel.CancelSelect(); return(false); } else if (PlaylistManager.state == PlaylistManager.PlaylistState.Creating) { PlaylistCreatePanel.CancelCreate(); } else if (PlaylistManager.state == PlaylistManager.PlaylistState.Editing) { PlaylistEditPanel.CancelEdit(); } else if (PlaylistManager.state == PlaylistManager.PlaylistState.Endless) { PlaylistEndlessPanel.CancelEndless(); } else { if (SongDownloaderUI.songItemPanel != null) { SongDownloaderUI.songItemPanel.SetPageActive(false); } if (SongDownloader.needRefresh) { SongBrowser.ReloadSongList(false); } } return(true); }
private static bool Prefix(KeyboardEntry __instance, KeyCode keyCode, string label) { if (SongBrowser.shouldShowKeyboard) { if (PlaylistManager.state == PlaylistManager.PlaylistState.Creating) { switch (label) { case "done": __instance.Hide(); break; case "clear": PlaylistCreatePanel.newName = ""; break; default: PlaylistCreatePanel.newName += label; break; } if (PlaylistCreatePanel.playlistText != null) { PlaylistCreatePanel.playlistText.text = PlaylistCreatePanel.newName; } } if (SongSearch.searchInProgress) { switch (label) { case "done": __instance.Hide(); SongBrowser.shouldShowKeyboard = false; SongSearch.OnNewUserSearch(); break; case "clear": SongSearch.query = ""; break; default: SongSearch.query += label; break; } if (SongSearchScreen.searchText != null) { SongSearchScreen.searchText.text = SongSearch.query; } } else { switch (label) { case "done": __instance.Hide(); SongBrowser.shouldShowKeyboard = false; SongDownloader.StartNewSongSearch(); break; case "clear": SongDownloader.searchString = ""; break; default: SongDownloader.searchString += label; break; } if (SongDownloaderUI.searchText != null) { SongDownloaderUI.searchText.text = SongDownloader.searchString; } } return(false); } else { return(true); } }