1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Merge pull request #975 from peppy/new-menu-backgrounds

Add new main menu backgrounds
This commit is contained in:
Dan Balasescu 2017-06-27 00:02:30 +09:00 committed by GitHub
commit 5910d7f971
5 changed files with 38 additions and 8 deletions

@ -1 +1 @@
Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f
Subproject commit 25b660ce322922abbb9be53caca2041c0e0c3ba0

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

View File

@ -2,16 +2,38 @@
// 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 newBackground)
{
current?.FadeOut(800, EasingTypes.OutQuint);
current?.Expire();
Add(current = newBackground);
}
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();