1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +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<bool> autoCursorScale;
private IBindable<WorkingBeatmap> beatmap;
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
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<double>(OsuSetting.GameplayCursorSize);

View File

@ -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
/// </summary>
public Action<BeatmapSetInfo, int> OrderChanged;
private BindableBeatmap beatmap;
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
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[]

View File

@ -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<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
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;

View File

@ -27,7 +27,7 @@ namespace osu.Game.Screens.Menu
/// </summary>
public bool DidLoadMenu;
private BindableBeatmap beatmapBacking;
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private MainMenu mainMenu;
private SampleChannel welcome;
@ -43,12 +43,12 @@ namespace osu.Game.Screens.Menu
private Bindable<bool> menuVoice;
private Bindable<bool> 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<bool>(OsuSetting.MenuVoice);
menuMusic = config.GetBindable<bool>(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();