1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Explicitly construct local beatmaps rather than using GetBoundCopy

This commit is contained in:
smoogipoo 2018-06-06 20:19:30 +09:00
parent 72cc53aded
commit ff60f69f47
4 changed files with 14 additions and 12 deletions

View File

@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private Bindable<double> cursorScale; private Bindable<double> cursorScale;
private Bindable<bool> autoCursorScale; private Bindable<bool> autoCursorScale;
private IBindable<WorkingBeatmap> beatmap; private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
public OsuCursor() public OsuCursor()
{ {
@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };
this.beatmap = beatmap.GetBoundCopy(); this.beatmap.BindTo(beatmap);
beatmap.ValueChanged += v => calculateScale(); beatmap.ValueChanged += v => calculateScale();
cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize); cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -26,7 +27,7 @@ namespace osu.Game.Overlays.Music
/// </summary> /// </summary>
public Action<BeatmapSetInfo, int> OrderChanged; public Action<BeatmapSetInfo, int> OrderChanged;
private BindableBeatmap beatmap; private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private BeatmapManager beatmaps; private BeatmapManager beatmaps;
private FilterControl filter; private FilterControl filter;
@ -35,7 +36,7 @@ namespace osu.Game.Overlays.Music
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, BindableBeatmap beatmap, BeatmapManager beatmaps) private void load(OsuColour colours, BindableBeatmap beatmap, BeatmapManager beatmaps)
{ {
this.beatmap = beatmap.GetBoundCopy(); this.beatmap.BindTo(beatmap);
this.beatmaps = beatmaps; this.beatmaps = beatmaps;
Children = new Drawable[] Children = new Drawable[]

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -54,7 +55,7 @@ namespace osu.Game.Overlays
private Container dragContainer; private Container dragContainer;
private Container playerContainer; private Container playerContainer;
private BindableBeatmap beatmap; private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
public MusicController() public MusicController()
{ {
@ -96,7 +97,7 @@ namespace osu.Game.Overlays
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation) private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation)
{ {
this.beatmap = beatmap.GetBoundCopy(); this.beatmap.BindTo(beatmap);
this.beatmaps = beatmaps; this.beatmaps = beatmaps;
this.localisation = localisation; this.localisation = localisation;

View File

@ -27,7 +27,7 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public bool DidLoadMenu; public bool DidLoadMenu;
private BindableBeatmap beatmapBacking; private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private MainMenu mainMenu; private MainMenu mainMenu;
private SampleChannel welcome; private SampleChannel welcome;
@ -43,12 +43,12 @@ namespace osu.Game.Screens.Menu
private Bindable<bool> menuVoice; private Bindable<bool> menuVoice;
private Bindable<bool> menuMusic; private Bindable<bool> menuMusic;
private Track track; private Track track;
private WorkingBeatmap beatmap; private WorkingBeatmap introBeatmap;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
{ {
beatmapBacking = beatmap.GetBoundCopy(); this.beatmap.BindTo(beatmap);
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice); menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic); menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
@ -76,8 +76,8 @@ namespace osu.Game.Screens.Menu
} }
} }
this.beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
track = this.beatmap.Track; track = introBeatmap.Track;
welcome = audio.Sample.Get(@"welcome"); welcome = audio.Sample.Get(@"welcome");
seeya = audio.Sample.Get(@"seeya"); seeya = audio.Sample.Get(@"seeya");
@ -94,7 +94,7 @@ namespace osu.Game.Screens.Menu
if (!resuming) if (!resuming)
{ {
beatmapBacking.Value = beatmap; beatmap.Value = introBeatmap;
if (menuVoice) if (menuVoice)
welcome.Play(); welcome.Play();