Merge pull request #31143 from peppy/no-pause-cooldown-break-intro

Skip the pause cooldown when in intro / break time
This commit is contained in:
Bartłomiej Dach 2024-12-20 12:29:46 +01:00 committed by GitHub
commit e62b329d4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
@ -19,6 +20,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osu.Game.Storyboards;
using osuTK;
using osuTK.Input;
@ -28,6 +30,12 @@ namespace osu.Game.Tests.Visual.Gameplay
{
protected new PausePlayer Player => (PausePlayer)base.Player;
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
{
beatmap.AudioLeadIn = 4000;
return base.CreateWorkingBeatmap(beatmap, storyboard);
}
private readonly Container content;
protected override Container<Drawable> Content => content;
@ -200,8 +208,10 @@ namespace osu.Game.Tests.Visual.Gameplay
}
[Test]
[Ignore("Fails on github runners if they happen to skip too far forward in time.")]
public void TestUserPauseDuringCooldownTooSoon()
{
AddStep("seek to gameplay", () => Player.GameplayClockContainer.Seek(0));
AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10)));
pauseAndConfirm();
@ -213,9 +223,23 @@ namespace osu.Game.Tests.Visual.Gameplay
confirmNotExited();
}
[Test]
public void TestUserPauseDuringIntroSkipsCooldown()
{
AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10)));
pauseAndConfirm();
resume();
pauseViaBackAction();
confirmPaused();
}
[Test]
public void TestQuickExitDuringCooldownTooSoon()
{
AddStep("seek to gameplay", () => Player.GameplayClockContainer.Seek(0));
AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10)));
pauseAndConfirm();

View File

@ -1021,7 +1021,7 @@ namespace osu.Game.Screens.Play
private double? lastPauseActionTime;
protected bool PauseCooldownActive =>
lastPauseActionTime.HasValue && GameplayClockContainer.CurrentTime < lastPauseActionTime + PauseCooldownDuration;
PlayingState.Value == LocalUserPlayingState.Playing && lastPauseActionTime.HasValue && GameplayClockContainer.CurrentTime < lastPauseActionTime + PauseCooldownDuration;
/// <summary>
/// A set of conditionals which defines whether the current game state and configuration allows for