2017-02-07 13:59:30 +09:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-10-06 23:32:35 +09:00
|
|
|
|
|
2016-11-08 18:13:20 -05:00
|
|
|
|
using osu.Framework.Allocation;
|
2017-06-26 19:06:08 +09:00
|
|
|
|
using osu.Framework.Graphics;
|
2016-11-23 11:59:50 +09:00
|
|
|
|
using osu.Game.Graphics.Backgrounds;
|
2016-10-06 23:32:35 +09:00
|
|
|
|
|
2016-11-14 17:23:33 +09:00
|
|
|
|
namespace osu.Game.Screens.Backgrounds
|
2016-10-06 23:32:35 +09:00
|
|
|
|
{
|
2017-02-17 18:59:30 +09:00
|
|
|
|
public class BackgroundScreenDefault : BackgroundScreen
|
2016-10-06 23:32:35 +09:00
|
|
|
|
{
|
2017-06-26 19:06:08 +09:00
|
|
|
|
private int currentDisplay;
|
|
|
|
|
private const int background_count = 5;
|
|
|
|
|
|
|
|
|
|
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
|
|
|
|
|
|
|
|
|
|
private Background current;
|
|
|
|
|
|
2016-11-12 19:44:16 +09:00
|
|
|
|
[BackgroundDependencyLoader]
|
2017-02-27 17:32:32 +03:00
|
|
|
|
private void load()
|
2016-10-06 23:32:35 +09:00
|
|
|
|
{
|
2017-06-26 19:06:08 +09:00
|
|
|
|
display(new Background(backgroundName));
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-26 23:05:35 +09:00
|
|
|
|
private void display(Background newBackground)
|
2017-06-26 19:06:08 +09:00
|
|
|
|
{
|
2017-07-22 20:50:25 +02:00
|
|
|
|
current?.FadeOut(800, Easing.OutQuint);
|
2017-06-26 19:06:08 +09:00
|
|
|
|
current?.Expire();
|
|
|
|
|
|
2017-06-26 23:05:35 +09:00
|
|
|
|
Add(current = newBackground);
|
2017-06-26 19:06:08 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Next()
|
|
|
|
|
{
|
|
|
|
|
currentDisplay++;
|
|
|
|
|
LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display);
|
2016-10-06 23:32:35 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-26 23:05:35 +09:00
|
|
|
|
}
|