diff --git a/osu.Game/Overlays/Pause/PauseButton.cs b/osu.Game/Overlays/Pause/PauseButton.cs index eeb24b969b..9914caf37d 100644 --- a/osu.Game/Overlays/Pause/PauseButton.cs +++ b/osu.Game/Overlays/Pause/PauseButton.cs @@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Pause private float colourExpandTime = 500; private float shear = 0.2f; private float glowGradientEndAlpha = 0f; - private double pressExpandTime = 100; private Color4 buttonColour; private Color4 backgroundColour = OsuColour.Gray(34); @@ -60,7 +59,7 @@ namespace osu.Game.Overlays.Pause protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args) { - colourContainer.ResizeTo(new Vector2(1.1f, 1f), pressExpandTime, EasingTypes.In); + colourContainer.ResizeTo(new Vector2(1.1f, 1f), 200, EasingTypes.In); sampleClick?.Play(); Action?.Invoke(); return true; @@ -204,7 +203,7 @@ namespace osu.Game.Overlays.Pause Font = "Exo2.0-Bold", Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.1f), - Colour = Color4.White + Colour = Color4.White, } }); } diff --git a/osu.Game/Overlays/Pause/PauseOverlay.cs b/osu.Game/Overlays/Pause/PauseOverlay.cs index 2e91604e04..3d345eb404 100644 --- a/osu.Game/Overlays/Pause/PauseOverlay.cs +++ b/osu.Game/Overlays/Pause/PauseOverlay.cs @@ -23,13 +23,15 @@ namespace osu.Game.Overlays.Pause private SpriteText retryCounter; + public override bool Contains(Vector2 screenSpacePos) => true; + [BackgroundDependencyLoader] private void load(OsuColour colours) { Children = new Drawable[] { - new ClickableContainer + new Container { RelativeSizeAxes = Axes.Both, @@ -147,15 +149,8 @@ namespace osu.Game.Overlays.Pause retryCounter.Text = $"You've retried {String.Format("{0:n0}", count)} time{(count == 1) ? "" : "s"} in this session"; } - protected override void PopIn() - { - FadeTo(1, fadeDuration, EasingTypes.In); - } - - protected override void PopOut() - { - FadeTo(0, fadeDuration, EasingTypes.In); - } + protected override void PopIn() => FadeIn(fadeDuration, EasingTypes.In); + protected override void PopOut() => FadeOut(fadeDuration, EasingTypes.In); protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e1ef040307..02a5f93a36 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play public PlayMode PreferredPlayMode; - public bool isPaused; + public bool IsPaused; private double pauseCooldown = 1000; private double lastActionTime = 0; @@ -56,6 +56,7 @@ namespace osu.Game.Screens.Play private ScoreOverlay scoreOverlay; private PauseOverlay pauseOverlay; + private PlayerInputManager playerInputManager; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config) @@ -123,7 +124,7 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { - new PlayerInputManager(game.Host) + playerInputManager = new PlayerInputManager(game.Host) { Clock = new InterpolatingFramedClock(sourceClock), PassThrough = false, @@ -142,35 +143,38 @@ namespace osu.Game.Screens.Play if (Time.Current >= (lastActionTime + pauseCooldown) || force) { lastActionTime = Time.Current; - isPaused = true; + playerInputManager.PassThrough = true; scoreOverlay.KeyCounter.IsCounting = false; pauseOverlay.Show(); sourceClock.Stop(); + IsPaused = true; } else { - isPaused = false; + IsPaused = false; } } public void Resume() { lastActionTime = Time.Current; - isPaused = false; + playerInputManager.PassThrough = false; scoreOverlay.KeyCounter.IsCounting = true; pauseOverlay.Hide(); sourceClock.Start(); + IsPaused = false; } public void TogglePaused() { - isPaused = !isPaused; - if (isPaused) Pause(); else Resume(); + IsPaused = !IsPaused; + if (IsPaused) Pause(); else Resume(); } public void Restart() { // TODO: Implement retrying + if (IsPaused) Resume(); } protected override void LoadComplete() @@ -237,12 +241,12 @@ namespace osu.Game.Screens.Play switch (args.Key) { case Key.Escape: - if (!isPaused) + if (!IsPaused) { Pause(); return true; } - else { return false; } + return false; } return base.OnKeyDown(state, args); }