IEnumerator SelectAndLoadSong(IStandardLevel level) { AddToQueue(level); var diff = minDiff; IStandardLevelDifficultyBeatmap difficultyLevel = null; do { diff = (LevelDifficulty)UnityEngine.Random.Range((int)minDiff, (int)maxDiff + 1); difficultyLevel = level.GetDifficultyLevel(diff); } while (difficultyLevel == null); if (autoPlay) { // Fade screen away to not spoil song var gameSceneManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); gameSceneManager.HandleExecutorTransitionDidStart(0.7f); //var fade = Resources.FindObjectsOfTypeAll<FadeOutOnGameEvent>().FirstOrDefault(); //fade.HandleGameEvent(0.7f); // Turn preview down player.volume = 0; yield return(new WaitForSeconds(1.0f)); } int row = listTableView.RowNumberForLevelID(level.levelID); tableView.SelectRow(row, true); tableView.ScrollToRow(row, false); difficultyViewController.SetDifficultyLevels(level.difficultyBeatmaps, difficultyLevel); var gameplayMode = detailViewController.gameplayMode; var gameplayOptions = detailViewController.gameplayOptions; detailViewController.SetContent(difficultyLevel, gameplayMode); if (autoPlay) { detailViewController.PlayButtonPressed(); if (gameplayMode.IsSolo() && !gameplayOptions.validForScoreUse) { var prompt = flowController.GetPrivateField <SimpleDialogPromptViewController>("_simpleDialogPromptViewController"); yield return(new WaitForSeconds(0.1f)); flowController.HandleSimpleDialogPromptViewControllerDidFinish(prompt, true); } } }