Pass adjustable clocks to components, rather than relying on the track

This commit is contained in:
smoogipoo
2018-03-15 18:08:37 +09:00
parent c8f6a6980b
commit d05947ef48
6 changed files with 33 additions and 24 deletions

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
@ -19,8 +20,12 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
private readonly Drawable marker;
public MarkerPart()
private readonly IAdjustableClock adjustableClock;
public MarkerPart(IAdjustableClock adjustableClock)
{
this.adjustableClock = adjustableClock;
Add(marker = new MarkerVisualisation());
}
@ -53,12 +58,12 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
seekTo(markerPos / DrawWidth * Beatmap.Value.Track.Length);
}
private void seekTo(double time) => Beatmap.Value?.Track.Seek(time);
private void seekTo(double time) => adjustableClock.Seek(time);
protected override void Update()
{
base.Update();
marker.X = (float)(Beatmap.Value?.Track.CurrentTime ?? 0);
marker.X = (float)adjustableClock.CurrentTime;
}
protected override void LoadBeatmap(WorkingBeatmap beatmap)