mirror of
https://github.com/ppy/osu
synced 2024-12-12 01:48:49 +00:00
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:
parent
21a2e27e5f
commit
5f634f2812
@ -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;
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user