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

Add new main menu backgrounds

This commit is contained in:
Dean Herbert 2017-06-26 19:06:08 +09:00
parent e6818a45be
commit cbf188c293
4 changed files with 37 additions and 6 deletions

@ -1 +1 @@
Subproject commit 10fda22522ffadbdbc43fa0f3683a065e536f7d1
Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5

View File

@ -2,16 +2,39 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Screens.Backgrounds
{
public class BackgroundScreenDefault : BackgroundScreen
{
private int currentDisplay;
private const int background_count = 5;
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
private Background current;
[BackgroundDependencyLoader]
private void load()
{
Add(new Background(@"Backgrounds/bg1"));
display(new Background(backgroundName));
}
private void display(Background b)
{
current?.FadeOut(800, EasingTypes.OutQuint);
current?.Expire();
Add(current = b);
}
public void Next()
{
currentDisplay++;
LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display);
}
}
}

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Game.Screens.Menu;
namespace osu.Game.Screens
@ -20,9 +19,9 @@ namespace osu.Game.Screens
private void load(OsuGame game)
{
if (game.IsDeployedBuild)
LoadComponentAsync(new Disclaimer(), d => Push((Screen)d));
LoadComponentAsync(new Disclaimer(), d => Push(d));
else
LoadComponentAsync(new Intro(), d => Push((Screen)d));
LoadComponentAsync(new Intro(), d => Push(d));
}
}
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Charts;
@ -24,7 +25,7 @@ namespace osu.Game.Screens.Menu
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
private readonly BackgroundScreen background;
private readonly BackgroundScreenDefault background;
private Screen songSelect;
protected override BackgroundScreen CreateBackground() => background;
@ -66,6 +67,12 @@ namespace osu.Game.Screens.Menu
preloadSongSelect();
}
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
{
base.OnBeatmapChanged(beatmap);
background.Next();
}
private void preloadSongSelect()
{
if (songSelect == null)
@ -111,6 +118,8 @@ namespace osu.Game.Screens.Menu
{
base.OnResuming(last);
background.Next();
//we may have consumed our preloaded instance, so let's make another.
preloadSongSelect();