1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Hide resume overlay when re-pausing gameplay (#6611)

Hide resume overlay when re-pausing gameplay

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-11-01 15:57:12 +09:00 committed by GitHub
commit 0820fde743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 7 deletions

View File

@ -38,9 +38,10 @@ namespace osu.Game.Rulesets.Osu.UI
});
}
public override void Show()
protected override void PopIn()
{
base.Show();
base.PopIn();
GameplayCursor.ActiveCursor.Hide();
cursorScaleContainer.MoveTo(GameplayCursor.ActiveCursor.Position);
clickToResumeCursor.Appear();
@ -55,13 +56,13 @@ namespace osu.Game.Rulesets.Osu.UI
}
}
public override void Hide()
protected override void PopOut()
{
base.PopOut();
localCursorContainer?.Expire();
localCursorContainer = null;
GameplayCursor.ActiveCursor.Show();
base.Hide();
GameplayCursor?.ActiveCursor?.Show();
}
protected override bool OnHover(HoverEvent e) => true;

View File

@ -69,6 +69,24 @@ namespace osu.Game.Tests.Visual.Gameplay
confirmClockRunning(true);
}
[Test]
public void TestPauseWithResumeOverlay()
{
AddStep("move cursor to center", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.Centre));
AddUntilStep("wait for hitobjects", () => Player.ScoreProcessor.Health.Value < 1);
pauseAndConfirm();
resume();
confirmClockRunning(false);
confirmPauseOverlayShown(false);
pauseAndConfirm();
AddUntilStep("resume overlay is not active", () => Player.DrawableRuleset.ResumeOverlay.State.Value == Visibility.Hidden);
confirmPaused();
}
[Test]
public void TestResumeWithResumeOverlaySkipped()
{

View File

@ -239,6 +239,12 @@ namespace osu.Game.Rulesets.UI
continueResume();
}
public override void CancelResume()
{
// called if the user pauses while the resume overlay is open
ResumeOverlay?.Hide();
}
/// <summary>
/// Creates and adds the visual representation of a <see cref="TObject"/> to this <see cref="DrawableRuleset{TObject}"/>.
/// </summary>
@ -453,6 +459,11 @@ namespace osu.Game.Rulesets.UI
/// <param name="continueResume">The action to run when resuming is to be completed.</param>
public abstract void RequestResume(Action continueResume);
/// <summary>
/// Invoked when the user requests to pause while the resume overlay is active.
/// </summary>
public abstract void CancelResume();
/// <summary>
/// Create a <see cref="ScoreProcessor"/> for the associated ruleset and link with this
/// <see cref="DrawableRuleset"/>.

View File

@ -443,7 +443,12 @@ namespace osu.Game.Screens.Play
{
if (!canPause) return;
IsResuming = false;
if (IsResuming)
{
DrawableRuleset.CancelResume();
IsResuming = false;
}
GameplayClockContainer.Stop();
PauseOverlay.Show();
lastPauseActionTime = GameplayClockContainer.GameplayClock.CurrentTime;