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> /// </summary>
public class EditorClock : DecoupleableInterpolatingFramedClock public class EditorClock : DecoupleableInterpolatingFramedClock
{ {
public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); //public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
public double TrackLength;
public ControlPointInfo ControlPointInfo; public ControlPointInfo ControlPointInfo;
@ -27,15 +29,15 @@ namespace osu.Game.Screens.Edit
{ {
this.beatDivisor = beatDivisor; this.beatDivisor = beatDivisor;
Beatmap.BindTo(beatmap); ControlPointInfo = beatmap.Value.Beatmap.ControlPointInfo;
TrackLength = beatmap.Value.Track.Length;
ControlPointInfo = Beatmap.Value.Beatmap.ControlPointInfo;
} }
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor) public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor)
{ {
this.beatDivisor = beatDivisor; this.beatDivisor = beatDivisor;
ControlPointInfo = controlPointInfo; ControlPointInfo = controlPointInfo;
TrackLength = trackLength;
} }
/// <summary> /// <summary>
@ -123,7 +125,8 @@ namespace osu.Game.Screens.Edit
if (seekTime > nextTimingPoint?.Time) if (seekTime > nextTimingPoint?.Time)
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); Seek(seekTime);
} }
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual
protected EditorClockTestCase() protected EditorClockTestCase()
{ {
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false }; Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false };
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]