mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Add new main menu backgrounds
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user