mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 19:12:56 +08:00
Add new main menu backgrounds
This commit is contained in:
parent
e6818a45be
commit
cbf188c293
@ -1 +1 @@
|
|||||||
Subproject commit 10fda22522ffadbdbc43fa0f3683a065e536f7d1
|
Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5
|
@ -2,16 +2,39 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Backgrounds
|
namespace osu.Game.Screens.Backgrounds
|
||||||
{
|
{
|
||||||
public class BackgroundScreenDefault : BackgroundScreen
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Screens;
|
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
@ -20,9 +19,9 @@ namespace osu.Game.Screens
|
|||||||
private void load(OsuGame game)
|
private void load(OsuGame game)
|
||||||
{
|
{
|
||||||
if (game.IsDeployedBuild)
|
if (game.IsDeployedBuild)
|
||||||
LoadComponentAsync(new Disclaimer(), d => Push((Screen)d));
|
LoadComponentAsync(new Disclaimer(), d => Push(d));
|
||||||
else
|
else
|
||||||
LoadComponentAsync(new Intro(), d => Push((Screen)d));
|
LoadComponentAsync(new Intro(), d => Push(d));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osu.Game.Screens.Charts;
|
using osu.Game.Screens.Charts;
|
||||||
@ -24,7 +25,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
|
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
|
||||||
|
|
||||||
private readonly BackgroundScreen background;
|
private readonly BackgroundScreenDefault background;
|
||||||
private Screen songSelect;
|
private Screen songSelect;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => background;
|
protected override BackgroundScreen CreateBackground() => background;
|
||||||
@ -66,6 +67,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
||||||
|
{
|
||||||
|
base.OnBeatmapChanged(beatmap);
|
||||||
|
background.Next();
|
||||||
|
}
|
||||||
|
|
||||||
private void preloadSongSelect()
|
private void preloadSongSelect()
|
||||||
{
|
{
|
||||||
if (songSelect == null)
|
if (songSelect == null)
|
||||||
@ -111,6 +118,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
|
background.Next();
|
||||||
|
|
||||||
//we may have consumed our preloaded instance, so let's make another.
|
//we may have consumed our preloaded instance, so let's make another.
|
||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user