mirror of
https://github.com/ppy/osu.git
synced 2025-03-04 01:22:54 +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 double TrackLength => track.Value?.Length ?? 60000;
|
||||||
|
|
||||||
public ControlPointInfo ControlPointInfo;
|
public ControlPointInfo ControlPointInfo => Beatmap.ControlPointInfo;
|
||||||
|
|
||||||
|
public IBeatmap Beatmap { get; set; }
|
||||||
|
|
||||||
private readonly BindableBeatDivisor beatDivisor;
|
private readonly BindableBeatDivisor beatDivisor;
|
||||||
|
|
||||||
@ -42,25 +44,15 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSeeking { get; private set; }
|
public bool IsSeeking { get; private set; }
|
||||||
|
|
||||||
public EditorClock(IBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
public EditorClock(IBeatmap beatmap = null, BindableBeatDivisor beatDivisor = null)
|
||||||
: this(beatmap.ControlPointInfo, beatDivisor)
|
|
||||||
{
|
{
|
||||||
}
|
Beatmap = beatmap ?? new Beatmap();
|
||||||
|
|
||||||
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
|
this.beatDivisor = beatDivisor ?? new BindableBeatDivisor();
|
||||||
{
|
|
||||||
this.beatDivisor = beatDivisor;
|
|
||||||
|
|
||||||
ControlPointInfo = controlPointInfo;
|
|
||||||
|
|
||||||
underlyingClock = new DecoupleableInterpolatingFramedClock();
|
underlyingClock = new DecoupleableInterpolatingFramedClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditorClock()
|
|
||||||
: this(new ControlPointInfo(), new BindableBeatDivisor())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Seek to the closest snappable beat from a time.
|
/// Seek to the closest snappable beat from a time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -23,7 +22,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected EditorClockTestScene()
|
protected EditorClockTestScene()
|
||||||
{
|
{
|
||||||
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
|
Clock = new EditorClock(new Beatmap(), BeatDivisor) { IsCoupled = false };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
@ -44,7 +43,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
||||||
{
|
{
|
||||||
Clock.ControlPointInfo = e.NewValue.Beatmap.ControlPointInfo;
|
Clock.Beatmap = e.NewValue.Beatmap;
|
||||||
Clock.ChangeSource(e.NewValue.Track);
|
Clock.ChangeSource(e.NewValue.Track);
|
||||||
Clock.ProcessFrame();
|
Clock.ProcessFrame();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user