1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Ensure we don't ping-pong nearestBreakIndex between breaks

This commit is contained in:
Shane Woolcock 2019-07-26 08:34:18 +09:30
parent 5e51012800
commit 1d6c321e14

View File

@ -136,11 +136,16 @@ namespace osu.Game.Screens.Play
return;
}
while (nearestBreakIndex < breaks.Count - 1 && Clock.CurrentTime > breaks[nearestBreakIndex].EndTime)
nearestBreakIndex++;
while (nearestBreakIndex > 0 && Clock.CurrentTime < breaks[nearestBreakIndex].StartTime)
nearestBreakIndex--;
if (Clock.CurrentTime > breaks[nearestBreakIndex].EndTime)
{
while (nearestBreakIndex < breaks.Count - 1 && Clock.CurrentTime > breaks[nearestBreakIndex].EndTime)
nearestBreakIndex++;
}
else
{
while (nearestBreakIndex > 0 && Clock.CurrentTime < breaks[nearestBreakIndex].StartTime)
nearestBreakIndex--;
}
// This ensures that IsBreakTime is generally consistent with the overlay's transforms during a break.
// If the overlay never shows (break.HasEffect is false), IsBreakTime should be false.