From ff60f69f47be9a5703d2790956e379b7ff1a4ecd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 6 Jun 2018 20:19:30 +0900 Subject: [PATCH] Explicitly construct local beatmaps rather than using GetBoundCopy --- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 4 ++-- osu.Game/Overlays/Music/PlaylistOverlay.cs | 5 +++-- osu.Game/Overlays/MusicController.cs | 5 +++-- osu.Game/Screens/Menu/Intro.cs | 12 ++++++------ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index b6e639ea52..240d8dc396 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private Bindable cursorScale; private Bindable autoCursorScale; - private IBindable beatmap; + private readonly IBindable beatmap = new Bindable(); public OsuCursor() { @@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor RelativeSizeAxes = Axes.Both, }; - this.beatmap = beatmap.GetBoundCopy(); + this.beatmap.BindTo(beatmap); beatmap.ValueChanged += v => calculateScale(); cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 440ac15791..b74e7e1178 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -4,6 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -26,7 +27,7 @@ namespace osu.Game.Overlays.Music /// public Action OrderChanged; - private BindableBeatmap beatmap; + private readonly Bindable beatmap = new Bindable(); private BeatmapManager beatmaps; private FilterControl filter; @@ -35,7 +36,7 @@ namespace osu.Game.Overlays.Music [BackgroundDependencyLoader] private void load(OsuColour colours, BindableBeatmap beatmap, BeatmapManager beatmaps) { - this.beatmap = beatmap.GetBoundCopy(); + this.beatmap.BindTo(beatmap); this.beatmaps = beatmaps; Children = new Drawable[] diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 2ef48f9ffa..18e5379224 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -54,7 +55,7 @@ namespace osu.Game.Overlays private Container dragContainer; private Container playerContainer; - private BindableBeatmap beatmap; + private readonly Bindable beatmap = new Bindable(); public MusicController() { @@ -96,7 +97,7 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation) { - this.beatmap = beatmap.GetBoundCopy(); + this.beatmap.BindTo(beatmap); this.beatmaps = beatmaps; this.localisation = localisation; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 0f374c7d4d..b0472ae705 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Menu /// public bool DidLoadMenu; - private BindableBeatmap beatmapBacking; + private readonly Bindable beatmap = new Bindable(); private MainMenu mainMenu; private SampleChannel welcome; @@ -43,12 +43,12 @@ namespace osu.Game.Screens.Menu private Bindable menuVoice; private Bindable menuMusic; private Track track; - private WorkingBeatmap beatmap; + private WorkingBeatmap introBeatmap; [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) { - beatmapBacking = beatmap.GetBoundCopy(); + this.beatmap.BindTo(beatmap); menuVoice = config.GetBindable(OsuSetting.MenuVoice); menuMusic = config.GetBindable(OsuSetting.MenuMusic); @@ -76,8 +76,8 @@ namespace osu.Game.Screens.Menu } } - this.beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); - track = this.beatmap.Track; + introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); + track = introBeatmap.Track; welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); @@ -94,7 +94,7 @@ namespace osu.Game.Screens.Menu if (!resuming) { - beatmapBacking.Value = beatmap; + beatmap.Value = introBeatmap; if (menuVoice) welcome.Play();