1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Implement background switching based on the intro

Only the Welcome intro has its own unique background right now
This commit is contained in:
Shivam 2020-07-02 19:12:45 +02:00
parent 4bf45ea99a
commit 18e30a7fc4

View File

@ -22,11 +22,12 @@ namespace osu.Game.Screens.Backgrounds
private int currentDisplay;
private const int background_count = 7;
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
private string backgroundName;
private Bindable<User> user;
private Bindable<Skin> skin;
private Bindable<BackgroundSource> mode;
private Bindable<IntroSequence> introSequence;
[Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; }
@ -42,11 +43,13 @@ namespace osu.Game.Screens.Backgrounds
user = api.LocalUser.GetBoundCopy();
skin = skinManager.CurrentSkin.GetBoundCopy();
mode = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource);
introSequence = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence);
user.ValueChanged += _ => Next();
skin.ValueChanged += _ => Next();
mode.ValueChanged += _ => Next();
beatmap.ValueChanged += _ => Next();
introSequence.ValueChanged += _ => Next();
currentDisplay = RNG.Next(0, background_count);
@ -74,6 +77,17 @@ namespace osu.Game.Screens.Backgrounds
{
Background newBackground;
switch (introSequence.Value)
{
case IntroSequence.Welcome:
backgroundName = "Menu/menu-background-welcome";
break;
default:
backgroundName = $@"Menu/menu-background-{currentDisplay % background_count + 1}";
break;
}
if (user.Value?.IsSupporter ?? false)
{
switch (mode.Value)