1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 21:00:33 +08:00

Use BindTo instead of taking the game's beatmap bindable.

This commit is contained in:
smoogipooo 2017-05-22 17:01:43 +09:00
parent 609aac6453
commit f81ffa636d

View File

@ -11,7 +11,8 @@ namespace osu.Game.Graphics.Containers
{
public class BeatSyncedContainer : Container
{
private Bindable<WorkingBeatmap> beatmap;
private Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private int lastBeat;
private double lastTimingPointStart;
//This is to avoid sending new beats when not at the very start of the beat
@ -20,7 +21,7 @@ namespace osu.Game.Graphics.Containers
protected override void Update()
{
if (beatmap.Value == null)
if (beatmap.Value?.Track == null)
return;
double trackCurrentTime = beatmap.Value.Track.CurrentTime;
@ -53,7 +54,7 @@ namespace osu.Game.Graphics.Containers
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
beatmap = game.Beatmap;
beatmap.BindTo(game.Beatmap);
}
}
}