Remove unnecessary encapsulation workaround

The new implementation of `DecouplingClock` will not mutate the
underlying clock in any way (unless attempting to start it when
approaching from a negative time value).

This should be quite safe as a result.
This commit is contained in:
Dean Herbert 2023-09-21 18:45:34 +09:00
parent 21a2e27e5f
commit 5f634f2812
2 changed files with 2 additions and 14 deletions

View File

@ -142,10 +142,7 @@ namespace osu.Game.Beatmaps
#region Delegation of IAdjustableClock / ISourceChangeableClock to decoupled clock.
public void ChangeSource(IClock? source)
{
decoupledTrack.ChangeSource(source as Track ?? new TrackVirtual(60000));
}
public void ChangeSource(IClock? source) => decoupledTrack.ChangeSource(source);
public IClock Source => decoupledTrack.Source;

View File

@ -441,16 +441,7 @@ namespace osu.Game
}
}
private void onTrackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction)
{
// FramedBeatmapClock uses a decoupled clock internally which will mutate the source if it is an `IAdjustableClock`.
// We don't want this for now, as the intention of beatmapClock is to be a read-only source for beat sync components.
//
// Encapsulating in a FramedClock will avoid any mutations.
var framedClock = new FramedClock(beatmap.Track);
beatmapClock.ChangeSource(framedClock);
}
private void onTrackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction) => beatmapClock.ChangeSource(beatmap.Track);
protected virtual void InitialiseFonts()
{