mirror of
https://github.com/ppy/osu
synced 2024-12-16 03:45:46 +00:00
Some more clean up
This commit is contained in:
parent
d250dde537
commit
6c6ef946bd
@ -15,18 +15,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public override string Header => "failed";
|
public override string Header => "failed";
|
||||||
public override string Description => "you're dead, try again?";
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
|
@ -23,7 +23,6 @@ namespace osu.Game.Screens.Play
|
|||||||
if (args.Repeat) return false;
|
if (args.Repeat) return false;
|
||||||
if (args.Key == Key.Escape)
|
if (args.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
if (State == Visibility.Hidden) return false;
|
|
||||||
OnResume();
|
OnResume();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public BeatmapInfo BeatmapInfo;
|
public BeatmapInfo BeatmapInfo;
|
||||||
|
|
||||||
public bool IsPaused { get; private set; }
|
public bool IsPaused => !sourceClock.IsRunning;
|
||||||
|
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
@ -204,19 +204,13 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public void Pause(bool force = false)
|
public void Pause(bool force = false)
|
||||||
{
|
{
|
||||||
if (canPause || force)
|
if (!canPause && !force) return;
|
||||||
{
|
|
||||||
lastPauseActionTime = Time.Current;
|
lastPauseActionTime = Time.Current;
|
||||||
hudOverlay.KeyCounter.IsCounting = false;
|
hudOverlay.KeyCounter.IsCounting = false;
|
||||||
pauseOverlay.Retries = RestartCount;
|
pauseOverlay.Retries = RestartCount;
|
||||||
pauseOverlay.Show();
|
pauseOverlay.Show();
|
||||||
sourceClock.Stop();
|
sourceClock.Stop();
|
||||||
IsPaused = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IsPaused = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Resume()
|
public void Resume()
|
||||||
@ -225,13 +219,6 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.KeyCounter.IsCounting = true;
|
hudOverlay.KeyCounter.IsCounting = true;
|
||||||
pauseOverlay.Hide();
|
pauseOverlay.Hide();
|
||||||
sourceClock.Start();
|
sourceClock.Start();
|
||||||
IsPaused = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TogglePaused()
|
|
||||||
{
|
|
||||||
IsPaused = !IsPaused;
|
|
||||||
if (IsPaused) Pause(); else Resume();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
@ -273,11 +260,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void onFail()
|
private void onFail()
|
||||||
{
|
{
|
||||||
if (IsPaused)
|
|
||||||
{
|
|
||||||
pauseOverlay.Hide();
|
|
||||||
IsPaused = false;
|
|
||||||
}
|
|
||||||
sourceClock.Stop();
|
sourceClock.Stop();
|
||||||
|
|
||||||
Delay(500);
|
Delay(500);
|
||||||
@ -331,7 +313,7 @@ namespace osu.Game.Screens.Play
|
|||||||
//pause screen override logic.
|
//pause screen override logic.
|
||||||
if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true;
|
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();
|
Pause();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user