mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:42:56 +08:00
Add original sprite and visualiser
Notes: This is using a modified version of welcome.osz to facilitate the visualiser and the animation of the sprite is not accurate.
This commit is contained in:
parent
3d78ec90ac
commit
4ebc1d3721
@ -8,8 +8,8 @@ using osu.Game.Screens.Menu;
|
|||||||
namespace osu.Game.Tests.Visual.Menus
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneIntroLegacy : IntroTestScene
|
public class TestSceneIntroWelcome : IntroTestScene
|
||||||
{
|
{
|
||||||
protected override IScreen CreateScreen() => new IntroLegacy();
|
protected override IScreen CreateScreen() => new IntroWelcome();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -52,7 +52,7 @@ namespace osu.Game.Screens
|
|||||||
return new IntroCircles();
|
return new IntroCircles();
|
||||||
|
|
||||||
case IntroSequence.Welcome:
|
case IntroSequence.Welcome:
|
||||||
return new IntroLegacy();
|
return new IntroWelcome();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new IntroTriangles();
|
return new IntroTriangles();
|
||||||
|
@ -1,117 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osuTK;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
using osu.Framework.Screens;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
|
||||||
{
|
|
||||||
public class IntroLegacy : IntroScreen
|
|
||||||
{
|
|
||||||
protected override string BeatmapHash => "64E00D7022195959BFA3109D09C2E2276C8F12F486B91FCF6175583E973B48F2";
|
|
||||||
protected override string BeatmapFile => "welcome.osz";
|
|
||||||
private const double delay_step_two = 2142;
|
|
||||||
|
|
||||||
private SampleChannel welcome;
|
|
||||||
|
|
||||||
private SampleChannel pianoReverb;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(AudioManager audio)
|
|
||||||
{
|
|
||||||
Seeya = audio.Samples.Get(@"Intro/welcome/seeya");
|
|
||||||
|
|
||||||
if (MenuVoice.Value)
|
|
||||||
{
|
|
||||||
welcome = audio.Samples.Get(@"Intro/welcome/welcome");
|
|
||||||
pianoReverb = audio.Samples.Get(@"Intro/welcome/welcome_piano");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
|
||||||
{
|
|
||||||
base.LogoArriving(logo, resuming);
|
|
||||||
|
|
||||||
if (!resuming)
|
|
||||||
{
|
|
||||||
welcome?.Play();
|
|
||||||
pianoReverb?.Play();
|
|
||||||
Scheduler.AddDelayed(delegate
|
|
||||||
{
|
|
||||||
StartTrack();
|
|
||||||
|
|
||||||
PrepareMenuLoad();
|
|
||||||
|
|
||||||
logo.ScaleTo(1);
|
|
||||||
logo.FadeIn();
|
|
||||||
|
|
||||||
Scheduler.Add(LoadMenu);
|
|
||||||
}, delay_step_two);
|
|
||||||
|
|
||||||
LoadComponentAsync(new FallbackIntroSequence
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
}, t =>
|
|
||||||
{
|
|
||||||
AddInternal(t);
|
|
||||||
t.Start(delay_step_two);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
|
||||||
{
|
|
||||||
this.FadeOut(300);
|
|
||||||
base.OnSuspending(next);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FallbackIntroSequence : Container
|
|
||||||
{
|
|
||||||
private OsuSpriteText welcomeText;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
welcomeText = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Text = "welcome",
|
|
||||||
Padding = new MarginPadding { Bottom = 10 },
|
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42),
|
|
||||||
Alpha = 0,
|
|
||||||
Spacing = new Vector2(5),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Start(double length)
|
|
||||||
{
|
|
||||||
if (Children.Any())
|
|
||||||
{
|
|
||||||
// restart if we were already run previously.
|
|
||||||
FinishTransforms(true);
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
double remainingTime() => length - TransformDelay;
|
|
||||||
|
|
||||||
using (BeginDelayedSequence(250, true))
|
|
||||||
{
|
|
||||||
welcomeText.FadeIn(700);
|
|
||||||
welcomeText.ScaleTo(welcomeText.Scale + new Vector2(0.5f), remainingTime(), Easing.Out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
152
osu.Game/Screens/Menu/IntroWelcome.cs
Normal file
152
osu.Game/Screens/Menu/IntroWelcome.cs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osuTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Menu
|
||||||
|
{
|
||||||
|
public class IntroWelcome : IntroScreen
|
||||||
|
{
|
||||||
|
protected override string BeatmapHash => "64E00D7022195959BFA3109D09C2E2276C8F12F486B91FCF6175583E973B48F2";
|
||||||
|
protected override string BeatmapFile => "welcome.osz";
|
||||||
|
private const double delay_step_two = 2142;
|
||||||
|
private SampleChannel welcome;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
Seeya = audio.Samples.Get(@"Intro/welcome/seeya");
|
||||||
|
|
||||||
|
if (MenuVoice.Value)
|
||||||
|
welcome = audio.Samples.Get(@"Intro/welcome/welcome");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
{
|
||||||
|
base.LogoArriving(logo, resuming);
|
||||||
|
|
||||||
|
if (!resuming)
|
||||||
|
{
|
||||||
|
welcome?.Play();
|
||||||
|
StartTrack();
|
||||||
|
Scheduler.AddDelayed(delegate
|
||||||
|
{
|
||||||
|
PrepareMenuLoad();
|
||||||
|
|
||||||
|
logo.ScaleTo(1);
|
||||||
|
logo.FadeIn();
|
||||||
|
|
||||||
|
Scheduler.Add(LoadMenu);
|
||||||
|
}, delay_step_two);
|
||||||
|
|
||||||
|
LoadComponentAsync(new WelcomeIntroSequence
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}, AddInternal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnSuspending(IScreen next)
|
||||||
|
{
|
||||||
|
this.FadeOut(300);
|
||||||
|
base.OnSuspending(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class WelcomeIntroSequence : Container
|
||||||
|
{
|
||||||
|
private Sprite welcomeText;
|
||||||
|
private LogoVisualisation visualizer;
|
||||||
|
private Container elementContainer;
|
||||||
|
private Container circleContainer;
|
||||||
|
private Circle blackCircle;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
elementContainer = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
visualizer = new LogoVisualisation
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
AccentColour = Color4.Blue,
|
||||||
|
Size = new Vector2(0.96f)
|
||||||
|
},
|
||||||
|
circleContainer = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
blackCircle = new Circle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(480),
|
||||||
|
Colour = Color4.Black
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
welcomeText = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Scale = new Vector2(0.5f),
|
||||||
|
Texture = textures.Get(@"Welcome/welcome_text@2x")
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
double remainingTime() => delay_step_two - TransformDelay;
|
||||||
|
|
||||||
|
using (BeginDelayedSequence(250, true))
|
||||||
|
{
|
||||||
|
welcomeText.FadeIn(700);
|
||||||
|
welcomeText.ScaleTo(welcomeText.Scale + new Vector2(0.5f), remainingTime(), Easing.Out).OnComplete(_ =>
|
||||||
|
{
|
||||||
|
elementContainer.Remove(visualizer);
|
||||||
|
circleContainer.Remove(blackCircle);
|
||||||
|
elementContainer.Remove(circleContainer);
|
||||||
|
Remove(welcomeText);
|
||||||
|
visualizer.Dispose();
|
||||||
|
blackCircle.Dispose();
|
||||||
|
welcomeText.Dispose();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user