From 6c6ef946bde3fc2cdd357d1dfb0b361af49919fe Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 04:01:52 -0700 Subject: [PATCH] Some more clean up --- osu.Game/Screens/Play/FailOverlay.cs | 12 --------- osu.Game/Screens/Play/PauseOverlay.cs | 1 - osu.Game/Screens/Play/Player.cs | 36 +++++++-------------------- 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1cd34e45e7..1c0e01201e 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -15,18 +15,6 @@ namespace osu.Game.Screens.Play public override string Header => "failed"; public override string Description => "you're dead, try again?"; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Repeat) return false; - if (args.Key == Key.Escape) - { - if (State == Visibility.Hidden) return false; - OnQuit(); - return true; - } - - return base.OnKeyDown(state, args); - } [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 6088e2fea5..c8439b33e0 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -23,7 +23,6 @@ namespace osu.Game.Screens.Play if (args.Repeat) return false; if (args.Key == Key.Escape) { - if (State == Visibility.Hidden) return false; OnResume(); return true; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2a18d44248..2ae809a7c2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public bool IsPaused { get; private set; } + public bool IsPaused => !sourceClock.IsRunning; public bool HasFailed { get; private set; } @@ -204,19 +204,13 @@ namespace osu.Game.Screens.Play public void Pause(bool force = false) { - if (canPause || force) - { - lastPauseActionTime = Time.Current; - hudOverlay.KeyCounter.IsCounting = false; - pauseOverlay.Retries = RestartCount; - pauseOverlay.Show(); - sourceClock.Stop(); - IsPaused = true; - } - else - { - IsPaused = false; - } + if (!canPause && !force) return; + + lastPauseActionTime = Time.Current; + hudOverlay.KeyCounter.IsCounting = false; + pauseOverlay.Retries = RestartCount; + pauseOverlay.Show(); + sourceClock.Stop(); } public void Resume() @@ -225,13 +219,6 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.IsCounting = true; pauseOverlay.Hide(); sourceClock.Start(); - IsPaused = false; - } - - public void TogglePaused() - { - IsPaused = !IsPaused; - if (IsPaused) Pause(); else Resume(); } public void Restart() @@ -273,11 +260,6 @@ namespace osu.Game.Screens.Play private void onFail() { - if (IsPaused) - { - pauseOverlay.Hide(); - IsPaused = false; - } sourceClock.Stop(); Delay(500); @@ -331,7 +313,7 @@ namespace osu.Game.Screens.Play //pause screen override logic. if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; - if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map + if (!IsPaused) // For if the user presses escape quickly when entering the map { Pause(); return true;