mirror of
https://github.com/ppy/osu.git
synced 2025-02-28 17:02:55 +08:00
Merge branch 'master' into tournament-test-standardisation
This commit is contained in:
commit
053be84eb4
15
osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs
Normal file
15
osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneIntroWelcome : IntroTestScene
|
||||||
|
{
|
||||||
|
protected override IScreen CreateScreen() => new IntroWelcome();
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Parsing
|
public static class Parsing
|
||||||
{
|
{
|
||||||
public const int MAX_COORDINATE_VALUE = 65536;
|
public const int MAX_COORDINATE_VALUE = 131072;
|
||||||
|
|
||||||
public const double MAX_PARSE_VALUE = int.MaxValue;
|
public const double MAX_PARSE_VALUE = int.MaxValue;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ namespace osu.Game.Configuration
|
|||||||
public enum IntroSequence
|
public enum IntroSequence
|
||||||
{
|
{
|
||||||
Circles,
|
Circles,
|
||||||
|
Welcome,
|
||||||
Triangles,
|
Triangles,
|
||||||
Random
|
Random
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ namespace osu.Game.Screens
|
|||||||
case IntroSequence.Circles:
|
case IntroSequence.Circles:
|
||||||
return new IntroCircles();
|
return new IntroCircles();
|
||||||
|
|
||||||
|
case IntroSequence.Welcome:
|
||||||
|
return new IntroWelcome();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new IntroTriangles();
|
return new IntroTriangles();
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private SampleChannel seeya;
|
private SampleChannel seeya;
|
||||||
|
|
||||||
|
protected virtual string SeeyaSampleName => "Intro/seeya";
|
||||||
|
|
||||||
private LeasedBindable<WorkingBeatmap> beatmap;
|
private LeasedBindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
private MainMenu mainMenu;
|
private MainMenu mainMenu;
|
||||||
@ -72,7 +74,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||||
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||||
|
|
||||||
seeya = audio.Samples.Get(@"Intro/seeya");
|
seeya = audio.Samples.Get(SeeyaSampleName);
|
||||||
|
|
||||||
BeatmapSetInfo setInfo = null;
|
BeatmapSetInfo setInfo = null;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
if (MenuVoice.Value && !UsingThemedIntro)
|
if (MenuVoice.Value && !UsingThemedIntro)
|
||||||
welcome = audio.Samples.Get(@"welcome");
|
welcome = audio.Samples.Get(@"Intro/welcome");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
150
osu.Game/Screens/Menu/IntroWelcome.cs
Normal file
150
osu.Game/Screens/Menu/IntroWelcome.cs
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
// 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 osu.Game.Screens.Backgrounds;
|
||||||
|
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;
|
||||||
|
private SampleChannel pianoReverb;
|
||||||
|
protected override string SeeyaSampleName => "Intro/Welcome/seeya";
|
||||||
|
|
||||||
|
protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenDefault(false)
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
private BackgroundScreenDefault background;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
LoadComponentAsync(new WelcomeIntroSequence
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}, intro =>
|
||||||
|
{
|
||||||
|
PrepareMenuLoad();
|
||||||
|
|
||||||
|
intro.LogoVisualisation.AddAmplitudeSource(pianoReverb);
|
||||||
|
|
||||||
|
AddInternal(intro);
|
||||||
|
|
||||||
|
welcome?.Play();
|
||||||
|
pianoReverb?.Play();
|
||||||
|
|
||||||
|
Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
StartTrack();
|
||||||
|
|
||||||
|
const float fade_in_time = 200;
|
||||||
|
|
||||||
|
logo.ScaleTo(1);
|
||||||
|
logo.FadeIn(fade_in_time);
|
||||||
|
|
||||||
|
background.FadeIn(fade_in_time);
|
||||||
|
|
||||||
|
LoadMenu();
|
||||||
|
}, delay_step_two);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResuming(IScreen last)
|
||||||
|
{
|
||||||
|
base.OnResuming(last);
|
||||||
|
background.FadeOut(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class WelcomeIntroSequence : Container
|
||||||
|
{
|
||||||
|
private Sprite welcomeText;
|
||||||
|
private Container scaleContainer;
|
||||||
|
|
||||||
|
public LogoVisualisation LogoVisualisation { get; private set; }
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
scaleContainer = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
LogoVisualisation = new LogoVisualisation
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
AccentColour = Color4.DarkBlue,
|
||||||
|
Size = new Vector2(0.96f)
|
||||||
|
},
|
||||||
|
new Circle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(480),
|
||||||
|
Colour = Color4.Black
|
||||||
|
},
|
||||||
|
welcomeText = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Texture = textures.Get(@"Intro/Welcome/welcome_text")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
using (BeginDelayedSequence(0, true))
|
||||||
|
{
|
||||||
|
scaleContainer.ScaleTo(0.9f).ScaleTo(1, delay_step_two).OnComplete(_ => Expire());
|
||||||
|
scaleContainer.FadeInFromZero(1800);
|
||||||
|
|
||||||
|
welcomeText.ScaleTo(new Vector2(1, 0)).ScaleTo(Vector2.One, 400, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,10 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
@ -66,6 +69,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
public Color4 AccentColour { get; set; }
|
public Color4 AccentColour { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative movement of bars based on input amplification. Defaults to 1.
|
||||||
|
/// </summary>
|
||||||
|
public float Magnitude { get; set; } = 1;
|
||||||
|
|
||||||
private readonly float[] frequencyAmplitudes = new float[256];
|
private readonly float[] frequencyAmplitudes = new float[256];
|
||||||
|
|
||||||
private IShader shader;
|
private IShader shader;
|
||||||
@ -77,6 +85,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
Blending = BlendingParameters.Additive;
|
Blending = BlendingParameters.Additive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly List<IHasAmplitudes> amplitudeSources = new List<IHasAmplitudes>();
|
||||||
|
|
||||||
|
public void AddAmplitudeSource(IHasAmplitudes amplitudeSource)
|
||||||
|
{
|
||||||
|
amplitudeSources.Add(amplitudeSource);
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ShaderManager shaders, IBindable<WorkingBeatmap> beatmap)
|
private void load(ShaderManager shaders, IBindable<WorkingBeatmap> beatmap)
|
||||||
{
|
{
|
||||||
@ -84,12 +99,22 @@ namespace osu.Game.Screens.Menu
|
|||||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly float[] temporalAmplitudes = new float[ChannelAmplitudes.AMPLITUDES_SIZE];
|
||||||
|
|
||||||
private void updateAmplitudes()
|
private void updateAmplitudes()
|
||||||
{
|
{
|
||||||
var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null;
|
var effect = beatmap.Value.BeatmapLoaded && beatmap.Value.TrackLoaded
|
||||||
var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.Beatmap?.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null;
|
? beatmap.Value.Beatmap?.ControlPointInfo.EffectPointAt(beatmap.Value.Track.CurrentTime)
|
||||||
|
: null;
|
||||||
|
|
||||||
ReadOnlySpan<float> temporalAmplitudes = (track?.CurrentAmplitudes ?? ChannelAmplitudes.Empty).FrequencyAmplitudes.Span;
|
for (int i = 0; i < temporalAmplitudes.Length; i++)
|
||||||
|
temporalAmplitudes[i] = 0;
|
||||||
|
|
||||||
|
if (beatmap.Value.TrackLoaded)
|
||||||
|
addAmplitudesFromSource(beatmap.Value.Track);
|
||||||
|
|
||||||
|
foreach (var source in amplitudeSources)
|
||||||
|
addAmplitudesFromSource(source);
|
||||||
|
|
||||||
for (int i = 0; i < bars_per_visualiser; i++)
|
for (int i = 0; i < bars_per_visualiser; i++)
|
||||||
{
|
{
|
||||||
@ -128,6 +153,19 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
protected override DrawNode CreateDrawNode() => new VisualisationDrawNode(this);
|
protected override DrawNode CreateDrawNode() => new VisualisationDrawNode(this);
|
||||||
|
|
||||||
|
private void addAmplitudesFromSource([NotNull] IHasAmplitudes source)
|
||||||
|
{
|
||||||
|
if (source == null) throw new ArgumentNullException(nameof(source));
|
||||||
|
|
||||||
|
var amplitudes = source.CurrentAmplitudes.FrequencyAmplitudes.Span;
|
||||||
|
|
||||||
|
for (int i = 0; i < amplitudes.Length; i++)
|
||||||
|
{
|
||||||
|
if (i < temporalAmplitudes.Length)
|
||||||
|
temporalAmplitudes[i] += amplitudes[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class VisualisationDrawNode : DrawNode
|
private class VisualisationDrawNode : DrawNode
|
||||||
{
|
{
|
||||||
protected new LogoVisualisation Source => (LogoVisualisation)base.Source;
|
protected new LogoVisualisation Source => (LogoVisualisation)base.Source;
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Screens.Select
|
|||||||
public ImportFromStablePopup(Action importFromStable)
|
public ImportFromStablePopup(Action importFromStable)
|
||||||
{
|
{
|
||||||
HeaderText = @"You have no beatmaps!";
|
HeaderText = @"You have no beatmaps!";
|
||||||
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps, skins and scores?";
|
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps, skins and scores?\nThis will create a second copy of all files on disk.";
|
||||||
|
|
||||||
Icon = FontAwesome.Solid.Plane;
|
Icon = FontAwesome.Solid.Plane;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user