1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 03:47:26 +08:00
osu-lazer/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs
Dan Balasescu 803bb3c780 Cleanup.
2017-06-26 23:05:35 +09:00

40 lines
1.1 KiB
C#

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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()
{
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);
}
}
}