mirror of
https://github.com/ppy/osu
synced 2024-12-13 18:37:04 +00:00
Add global FramedBeatmapClock
for BeatSyncProvider
components
This commit is contained in:
parent
9050f54681
commit
fec744a7fe
@ -185,6 +185,12 @@ namespace osu.Game
|
||||
|
||||
private RealmAccess realm;
|
||||
|
||||
/// <summary>
|
||||
/// For now, this is used as a source specifically for beat synced components.
|
||||
/// Going forward, it could potentially be used as the single source-of-truth for beatmap timing.
|
||||
/// </summary>
|
||||
private readonly FramedBeatmapClock beatmapClock = new FramedBeatmapClock(true);
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private Container content;
|
||||
@ -368,10 +374,15 @@ namespace osu.Game
|
||||
AddInternal(MusicController = new MusicController());
|
||||
dependencies.CacheAs(MusicController);
|
||||
|
||||
MusicController.TrackChanged += onTrackChanged;
|
||||
AddInternal(beatmapClock);
|
||||
|
||||
Ruleset.BindValueChanged(onRulesetChanged);
|
||||
Beatmap.BindValueChanged(onBeatmapChanged);
|
||||
}
|
||||
|
||||
private void onTrackChanged(WorkingBeatmap beatmap, TrackChangeDirection direction) => beatmapClock.ChangeSource(beatmap.Track);
|
||||
|
||||
protected virtual void InitialiseFonts()
|
||||
{
|
||||
AddFont(Resources, @"Fonts/osuFont");
|
||||
@ -587,7 +598,7 @@ namespace osu.Game
|
||||
}
|
||||
|
||||
ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.BeatmapLoaded ? Beatmap.Value.Beatmap.ControlPointInfo : null;
|
||||
IClock IBeatSyncProvider.Clock => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track : (IClock)null;
|
||||
IClock IBeatSyncProvider.Clock => beatmapClock;
|
||||
ChannelAmplitudes IHasAmplitudes.CurrentAmplitudes => Beatmap.Value.TrackLoaded ? Beatmap.Value.Track.CurrentAmplitudes : ChannelAmplitudes.Empty;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user