1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 23:13:20 +08:00

Give OsuScreen a mutable BindableBeatmap

This commit is contained in:
smoogipoo 2018-06-06 20:19:53 +09:00
parent ff60f69f47
commit e77084bec4
3 changed files with 9 additions and 17 deletions

View File

@ -68,7 +68,7 @@ namespace osu.Game.Screens
/// </summary>
public virtual bool AllowBeatmapRulesetChange => true;
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected virtual float BackgroundParallaxAmount => 1;
@ -78,8 +78,8 @@ namespace osu.Game.Screens
private SampleChannel sampleExit;
[BackgroundDependencyLoader(permitNulls: true)]
private void load(IBindableBeatmap beatmap, OsuGame osuGame, AudioManager audio)
[BackgroundDependencyLoader(true)]
private void load(BindableBeatmap beatmap, OsuGame osuGame, AudioManager audio)
{
if (beatmap != null)
Beatmap.BindTo(beatmap);

View File

@ -30,8 +30,6 @@ namespace osu.Game.Screens.Select
protected readonly BeatmapDetailArea BeatmapDetails;
private bool removeAutoModOnResume;
private BindableBeatmap beatmap;
public PlaySongSelect()
{
FooterPanels.Add(modSelect = new ModSelectOverlay
@ -55,10 +53,8 @@ namespace osu.Game.Screens.Select
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu, BindableBeatmap beatmap)
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu)
{
this.beatmap = beatmap.GetBoundCopy();
if (osu != null) SelectedMods.BindTo(osu.SelectedMods);
modSelect.SelectedMods.BindTo(SelectedMods);
@ -160,7 +156,7 @@ namespace osu.Game.Screens.Select
}
Beatmap.Value.Track.Looping = false;
beatmap.Disabled = true;
Beatmap.Disabled = true;
sampleConfirm?.Play();

View File

@ -62,8 +62,6 @@ namespace osu.Game.Screens.Select
private SampleChannel sampleChangeDifficulty;
private SampleChannel sampleChangeBeatmap;
private BindableBeatmap beatmap;
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
@ -178,11 +176,9 @@ namespace osu.Game.Screens.Select
}
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, BindableBeatmap beatmap)
[BackgroundDependencyLoader(true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
{
this.beatmap = beatmap.GetBoundCopy();
dependencies.CacheAs(this);
if (Footer != null)
@ -219,7 +215,7 @@ namespace osu.Game.Screens.Select
public void Edit(BeatmapInfo beatmap)
{
this.beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
Push(new Editor());
}
@ -285,7 +281,7 @@ namespace osu.Game.Screens.Select
{
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
this.beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
ensurePlayingSelected(preview);
}