Combine and simplify beatmap change logic

This commit is contained in:
Dean Herbert
2019-11-22 02:32:02 +09:00
parent a97d760afa
commit f390e558c7
3 changed files with 1 additions and 21 deletions

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
@ -155,15 +154,6 @@ namespace osu.Game.Graphics.Containers
private class ScalingBackgroundScreen : BackgroundScreenDefault private class ScalingBackgroundScreen : BackgroundScreenDefault
{ {
private IBindable<WorkingBeatmap> beatmap;
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap)
{
this.beatmap = beatmap.GetBoundCopy();
this.beatmap.ValueChanged += _ => Next();
}
public override void OnEntering(IScreen last) public override void OnEntering(IScreen last)
{ {
this.FadeInFromZero(4000, Easing.OutQuint); this.FadeInFromZero(4000, Easing.OutQuint);

View File

@ -46,6 +46,7 @@ namespace osu.Game.Screens.Backgrounds
user.ValueChanged += _ => Next(); user.ValueChanged += _ => Next();
skin.ValueChanged += _ => Next(); skin.ValueChanged += _ => Next();
mode.ValueChanged += _ => Next(); mode.ValueChanged += _ => Next();
beatmap.ValueChanged += _ => Next();
currentDisplay = RNG.Next(0, background_count); currentDisplay = RNG.Next(0, background_count);

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -170,8 +169,6 @@ namespace osu.Game.Screens.Menu
track.Start(); track.Start();
} }
} }
Beatmap.ValueChanged += beatmap_ValueChanged;
} }
private bool exitConfirmed; private bool exitConfirmed;
@ -220,14 +217,6 @@ namespace osu.Game.Screens.Menu
seq.OnAbort(_ => buttons.SetOsuLogo(null)); seq.OnAbort(_ => buttons.SetOsuLogo(null));
} }
private void beatmap_ValueChanged(ValueChangedEvent<WorkingBeatmap> e)
{
if (!this.IsCurrentScreen())
return;
((BackgroundScreenDefault)Background).Next();
}
public override void OnSuspending(IScreen next) public override void OnSuspending(IScreen next)
{ {
base.OnSuspending(next); base.OnSuspending(next);