1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:13:18 +08:00

Fix BreakTracker.IsBreakTime not updated properly on breaks set

Causes a pause from focus lose when playing a beatmap that has a break section at the beginning, due to `IsBreakTime` incorrectly set to `false`
This commit is contained in:
Salman Ahmed 2021-02-05 10:28:33 +03:00
parent e1789c29b1
commit 8d18c7e929

View File

@ -23,16 +23,16 @@ namespace osu.Game.Screens.Play
/// </summary>
public IBindable<bool> IsBreakTime => isBreakTime;
private readonly BindableBool isBreakTime = new BindableBool();
private readonly BindableBool isBreakTime = new BindableBool(true);
public IReadOnlyList<BreakPeriod> Breaks
{
set
{
isBreakTime.Value = false;
breaks = new PeriodTracker(value.Where(b => b.HasEffect)
.Select(b => new Period(b.StartTime, b.EndTime - BreakOverlay.BREAK_FADE_DURATION)));
updateBreakTime();
}
}
@ -45,8 +45,12 @@ namespace osu.Game.Screens.Play
protected override void Update()
{
base.Update();
updateBreakTime();
}
var time = Clock.CurrentTime;
private void updateBreakTime()
{
var time = Clock?.CurrentTime ?? 0;
isBreakTime.Value = breaks?.IsInAny(time) == true
|| time < gameplayStartTime