Make the osu! logo shared game-wide

There should only ever be one osu! logo. It is now passed around between screens in a superfluous manner.
This commit is contained in:
Dean Herbert
2017-11-01 20:54:58 +09:00
parent 7fa3ac8cf2
commit b8b05fe8d2
9 changed files with 289 additions and 109 deletions

View File

@ -14,14 +14,13 @@ using osu.Game.Beatmaps.IO;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Menu
{
public class Intro : OsuScreen
{
private readonly OsuLogo logo;
private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
/// <summary>
@ -39,32 +38,10 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
public Intro()
{
Children = new Drawable[]
{
new ParallaxContainer
{
ParallaxAmount = 0.01f,
Children = new Drawable[]
{
logo = new OsuLogo
{
Alpha = 0,
Triangles = false,
Blending = BlendingMode.Additive,
Interactive = false,
Colour = Color4.DarkGray,
Ripple = false
}
}
}
};
}
private Bindable<bool> menuVoice;
private Bindable<bool> menuMusic;
private Track track;
private readonly ParallaxContainer parallax;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
@ -121,14 +98,48 @@ namespace osu.Game.Screens.Menu
{
DidLoadMenu = true;
Push(mainMenu);
}, 2300);
}, 600);
}, delay_step_one);
}, delay_step_two);
}
logo.ScaleTo(0.4f);
logo.FadeOut();
private const double delay_step_one = 2300;
private const double delay_step_two = 600;
logo.ScaleTo(1, 4400, Easing.OutQuint);
logo.FadeIn(20000, Easing.OutQuint);
public const int EXIT_DELAY = 3000;
protected override void LogoSetup(OsuLogo logo, bool resuming)
{
base.LogoSetup(logo, resuming);
logo.RelativePositionAxes = Axes.Both;
logo.Triangles = false;
logo.Colour = Color4.DarkGray;
logo.Ripple = false;
const int quick_appear = 150;
int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
if (!resuming)
{
logo.ScaleTo(0.4f);
logo.FadeOut();
logo.ScaleTo(1, delay_step_one + delay_step_two, Easing.OutQuint);
logo.FadeIn(delay_step_one + delay_step_two, Easing.OutQuint);
}
else
{
logo
.ScaleTo(1, initialMovementTime, Easing.OutQuint)
.FadeIn(quick_appear, Easing.OutQuint)
.Then()
.RotateTo(20, EXIT_DELAY * 1.5f)
.FadeOut(EXIT_DELAY);
}
}
protected override void OnSuspending(Screen next)
@ -148,7 +159,7 @@ namespace osu.Game.Screens.Menu
if (!(last is MainMenu))
Content.FadeIn(300);
double fadeOutTime = 2000;
double fadeOutTime = EXIT_DELAY;
//we also handle the exit transition.
if (menuVoice)
seeya.Play();