1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 06:12:56 +08:00

Simplify EditorClock.Seek method

This commit is contained in:
Dean Herbert 2019-10-30 19:09:46 +09:00
parent 073066170c
commit 7f2916454d

View File

@ -85,22 +85,8 @@ namespace osu.Game.Screens.Edit
var timingPoint = ControlPointInfo.TimingPointAt(CurrentTime);
if (direction < 0 && timingPoint.Time == CurrentTime)
{
// When going backwards and we're at the boundary of two timing points, we compute the seek distance with the timing point which we are seeking into
int activeIndex = -1;
for (int i = 0; i < ControlPointInfo.TimingPoints.Count; i++)
{
if (ControlPointInfo.TimingPoints[i] == timingPoint)
{
activeIndex = i;
break;
}
}
while (activeIndex > 0 && CurrentTime == timingPoint.Time)
timingPoint = ControlPointInfo.TimingPoints[--activeIndex];
}
timingPoint = ControlPointInfo.TimingPointAt(CurrentTime - 1);
double seekAmount = timingPoint.BeatLength / beatDivisor.Value * amount;
double seekTime = CurrentTime + seekAmount * direction;