public static void Prefix(SinglePlayerLevelSelectionFlowCoordinator __instance) { var lastLevelCollection = __instance.GetField <LevelSelectionNavigationController, LevelSelectionFlowCoordinator>("levelSelectionNavigationController").GetField <LevelCollectionNavigationController, LevelSelectionNavigationController>("_levelCollectionNavigationController").GetField <LevelCollectionViewController, LevelCollectionNavigationController>("_levelCollectionViewController")? .GetField <LevelCollectionTableView, LevelCollectionViewController>("_levelCollectionTableView")?.GetField <IPreviewBeatmapLevel[], LevelCollectionTableView>("_previewBeatmapLevels"); if (lastLevelCollection != null) { EndlessBehavior.LastLevelCollection = lastLevelCollection; } }
static bool Prefix(SinglePlayerLevelSelectionFlowCoordinator __instance, ref Action beforeSceneSwitchCallback, ref bool practice, LevelSelectionNavigationController ___levelSelectionNavigationController) { if (RecordingController.instance == null) { Logger.log?.Warn($"RecordingController is null, unable to start recording."); return(true); } if (!(OBSController.instance?.IsConnected ?? false)) { Logger.log?.Warn($"Not connected to OBS, skipping StartLevel override."); return(true); } if (Plugin.config.LevelStartDelay == 0) { RecordingController.instance.StartRecordingLevel(); SharedCoroutineStarter.instance.StartCoroutine(RecordingController.instance.GameStatusSetup()); return(true); } if (DelayedStartActive && WaitingToStart) { return(false); // Ignore this call to StartLevel } if (!WaitingToStart && DelayedStartActive) // Done waiting, start the level { DelayedStartActive = false; return(true); } DelayedStartActive = true; WaitingToStart = true; Logger.log?.Debug("LevelSelectionNavigationController_StartLevel"); LevelCollectionNavigationController navigationController = AccessNavigationController(ref ___levelSelectionNavigationController); StandardLevelDetailViewController detailViewController = AccessDetailViewController(ref navigationController); StandardLevelDetailView levelView = AccessDetailView(ref detailViewController); if (levelView != null) { levelView.actionButton.interactable = false; } SharedCoroutineStarter.instance.StartCoroutine(DelayedLevelStart(__instance, beforeSceneSwitchCallback, practice, levelView?.actionButton)); return(false); }
private static IEnumerator DelayedLevelStart(SinglePlayerLevelSelectionFlowCoordinator coordinator, Action beforeSceneSwitchCallback, bool practice, UnityEngine.UI.Button?playButton) { if (playButton != null) { playButton.interactable = false; } else { Logger.log?.Warn($"playButton is null for DelayedLevelStart, unable to disable while waiting."); } Logger.log?.Debug($"Delaying level start by {Plugin.config.LevelStartDelay} seconds..."); RecordingController.instance?.StartRecordingLevel(); yield return(new WaitForSeconds(Plugin.config.LevelStartDelay));; WaitingToStart = false; //playButton.interactable = true; StartLevel(coordinator, beforeSceneSwitchCallback, practice); if (RecordingController.instance != null) { SharedCoroutineStarter.instance.StartCoroutine(RecordingController.instance.GameStatusSetup()); } }