mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Fix EditorClock
retaining a reference to potentially outdated ControlPointInfo
This commit is contained in:
parent
563bf92529
commit
13f88cbc4e
@ -25,7 +25,9 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public double TrackLength => track.Value?.Length ?? 60000;
|
||||
|
||||
public ControlPointInfo ControlPointInfo;
|
||||
public ControlPointInfo ControlPointInfo => Beatmap.ControlPointInfo;
|
||||
|
||||
public IBeatmap Beatmap { get; set; }
|
||||
|
||||
private readonly BindableBeatDivisor beatDivisor;
|
||||
|
||||
@ -42,25 +44,15 @@ namespace osu.Game.Screens.Edit
|
||||
/// </summary>
|
||||
public bool IsSeeking { get; private set; }
|
||||
|
||||
public EditorClock(IBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||
: this(beatmap.ControlPointInfo, beatDivisor)
|
||||
public EditorClock(IBeatmap beatmap = null, BindableBeatDivisor beatDivisor = null)
|
||||
{
|
||||
}
|
||||
Beatmap = beatmap ?? new Beatmap();
|
||||
|
||||
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.beatDivisor = beatDivisor;
|
||||
|
||||
ControlPointInfo = controlPointInfo;
|
||||
this.beatDivisor = beatDivisor ?? new BindableBeatDivisor();
|
||||
|
||||
underlyingClock = new DecoupleableInterpolatingFramedClock();
|
||||
}
|
||||
|
||||
public EditorClock()
|
||||
: this(new ControlPointInfo(), new BindableBeatDivisor())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Seek to the closest snappable beat from a time.
|
||||
/// </summary>
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Screens.Edit;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -23,7 +22,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
protected EditorClockTestScene()
|
||||
{
|
||||
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
|
||||
Clock = new EditorClock(new Beatmap(), BeatDivisor) { IsCoupled = false };
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -44,7 +43,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
||||
{
|
||||
Clock.ControlPointInfo = e.NewValue.Beatmap.ControlPointInfo;
|
||||
Clock.Beatmap = e.NewValue.Beatmap;
|
||||
Clock.ChangeSource(e.NewValue.Track);
|
||||
Clock.ProcessFrame();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user