1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Merge remote-tracking branch 'upstream/master' into new-samples

This commit is contained in:
Dean Herbert 2017-06-29 11:51:51 -07:00
commit 7469d0e3ba
4 changed files with 37 additions and 7 deletions

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

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();