mirror of https://github.com/ppy/osu
Fix tests and implementation
This commit is contained in:
parent
dd9b9a18ac
commit
e44062b77a
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue