Fix tests and implementation

This commit is contained in:
AlFasGD 2018-05-08 16:37:06 +03:00
parent dd9b9a18ac
commit e44062b77a
2 changed files with 10 additions and 7 deletions

View File

@ -17,7 +17,9 @@ namespace osu.Game.Screens.Edit
/// </summary>
public class EditorClock : DecoupleableInterpolatingFramedClock
{
public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
//public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
public double TrackLength;
public ControlPointInfo ControlPointInfo;
@ -27,15 +29,15 @@ public EditorClock(Bindable<WorkingBeatmap> beatmap, BindableBeatDivisor beatDiv
{
this.beatDivisor = beatDivisor;
Beatmap.BindTo(beatmap);
ControlPointInfo = Beatmap.Value.Beatmap.ControlPointInfo;
ControlPointInfo = beatmap.Value.Beatmap.ControlPointInfo;
TrackLength = beatmap.Value.Track.Length;
}
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor)
{
this.beatDivisor = beatDivisor;
ControlPointInfo = controlPointInfo;
TrackLength = trackLength;
}
/// <summary>
@ -123,7 +125,8 @@ private void seek(int direction, bool snapped)
if (seekTime > nextTimingPoint?.Time)
seekTime = nextTimingPoint.Time;
seekTime = Math.Min(Math.Max(0, seekTime), Beatmap.Value.Track.Length); // Ensure the sought point is within the song's length
// Ensure the sought point is within the boundaries
seekTime = Math.Min(Math.Max(0, seekTime), TrackLength);
Seek(seekTime);
}
}

View File

@ -29,7 +29,7 @@ protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnl
protected EditorClockTestCase()
{
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false };
}
[BackgroundDependencyLoader]