Don’t allow ResumeContainers to appear during breaks (#4607)

Don’t allow ResumeContainers to appear during breaks

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-05-12 17:25:15 +09:00 committed by GitHub
commit bfa6156092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -29,5 +29,12 @@ namespace osu.Game.Beatmaps.Timing
/// Whether the break has any effect. Breaks that are too short are culled before they are added to the beatmap.
/// </summary>
public bool HasEffect => Duration >= MIN_BREAK_DURATION;
/// <summary>
/// Whether this break contains a specified time.
/// </summary>
/// <param name="time">The time to check in milliseconds.</param>
/// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns>
public bool Contains(double time) => time >= StartTime && time <= EndTime;
}
}

View File

@ -414,8 +414,9 @@ namespace osu.Game.Screens.Play
IsResuming = true;
PauseOverlay.Hide();
// time-based conditions may allow instant resume.
if (GameplayClockContainer.GameplayClock.CurrentTime < Beatmap.Value.Beatmap.HitObjects.First().StartTime)
// breaks and time-based conditions may allow instant resume.
double time = GameplayClockContainer.GameplayClock.CurrentTime;
if (Beatmap.Value.Beatmap.Breaks.Any(b => b.Contains(time)) || time < Beatmap.Value.Beatmap.HitObjects.First().StartTime)
completeResume();
else
DrawableRuleset.RequestResume(completeResume);