private static void DrawPlayer() { bool shouldExit = false; Task.Run(() => { while (Console.ReadKey(true).Key != ConsoleKey.Escape) { ; } shouldExit = true; relax.Stop(); timewarp.Stop(); }); while (!shouldExit) { Console.Clear(); Console.WriteLine("Idling"); Console.WriteLine("\nPress ESC to return to the main menu."); while (!osuManager.CanLoad && !shouldExit) { Thread.Sleep(5); } if (shouldExit) { break; } var beatmap = osuManager.Player.Beatmap; Console.Clear(); Console.WriteLine($"Playing {beatmap.Artist} - {beatmap.Title} ({beatmap.Creator}) [{beatmap.Version}]"); Console.WriteLine("\nPress ESC to return to the main menu."); var relaxTask = Task.Factory.StartNew(() => { if (configManager.EnableRelax && osuManager.Player.CurrentRuleset == Ruleset.Standard) { relax.Start(beatmap); } }); var timewarpTask = Task.Factory.StartNew(() => { if (configManager.EnableTimewarp) { timewarp.Start(); } }); Task.WaitAll(relaxTask, timewarpTask); } DrawMainMenu(); }
private static void StartRelax() { bool shouldExit = false; Task.Run(() => { while (Console.ReadKey(true).Key != ConsoleKey.Escape) { ; } shouldExit = true; relax.Stop(); }); while (!shouldExit) { Console.Clear(); Console.WriteLine("Idling"); Console.WriteLine("\nPress ESC to return to the main menu."); while (!osuManager.CanPlay && !shouldExit) { Thread.Sleep(5); } if (shouldExit) { break; } var beatmap = osuManager.Player.Beatmap; if (beatmap.GeneralSection.Mode != Ruleset.Standard) { Console.Clear(); Console.WriteLine("Only osu!standard beatmaps are supported!\n\nReturn to song select to continue or press ESC to return to main menu."); while (osuManager.CanPlay && !shouldExit) { Thread.Sleep(1); } if (shouldExit) { break; } continue; } Console.Clear(); Console.WriteLine($"Playing {beatmap.MetadataSection.Artist} - {beatmap.MetadataSection.Title} ({beatmap.MetadataSection.Creator}) [{beatmap.MetadataSection.Version}]"); Console.WriteLine("\nPress ESC to return to the main menu."); relax.Start(); } DrawMainMenu(); }