1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:42:56 +08:00

Take lease on WorkingBeatmap during intro screens to prevent weird interactions with Playback control.

This commit is contained in:
Lucas A 2019-08-18 19:32:56 +02:00
parent 8258c4a80a
commit 3fcd786198

View File

@ -28,11 +28,18 @@ namespace osu.Game.Screens.Menu
private Bindable<bool> menuVoice; private Bindable<bool> menuVoice;
private LeasedBindable<WorkingBeatmap> beatmap;
public new Bindable<WorkingBeatmap> Beatmap { get => beatmap; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack(); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game) private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
{ {
//we take a lease on the beatmap bindable to prevent music playback from changing / pausing music during intros, as it is causing weird interactions with certains intros
beatmap = base.Beatmap.BeginLease(false);
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice); menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
seeya = audio.Samples.Get(@"seeya"); seeya = audio.Samples.Get(@"seeya");
} }
@ -108,6 +115,8 @@ namespace osu.Game.Screens.Menu
protected void LoadMenu() protected void LoadMenu()
{ {
DidLoadMenu = true; DidLoadMenu = true;
beatmap.Return(); //we return the lease to the beatmap bindable as we're pushing the main menu.
this.Push(mainMenu); this.Push(mainMenu);
} }
} }