mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 09:37:23 +08:00
Centralise track handling
This commit is contained in:
parent
c3d56088d8
commit
449e53ee6d
@ -30,19 +30,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
if (!resuming)
|
if (!resuming)
|
||||||
{
|
{
|
||||||
Beatmap.Value = IntroBeatmap;
|
|
||||||
IntroBeatmap = null;
|
|
||||||
|
|
||||||
Welcome?.Play();
|
Welcome?.Play();
|
||||||
|
|
||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
|
StartTrack();
|
||||||
if (MenuMusic.Value)
|
|
||||||
{
|
|
||||||
Track.Restart();
|
|
||||||
Track = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
PrepareMenuLoad();
|
PrepareMenuLoad();
|
||||||
|
|
||||||
@ -57,8 +49,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
Track = null;
|
|
||||||
|
|
||||||
this.FadeOut(300);
|
this.FadeOut(300);
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
protected Bindable<bool> MenuMusic;
|
protected Bindable<bool> MenuMusic;
|
||||||
|
|
||||||
protected Track Track;
|
protected Track Track { get; private set; }
|
||||||
|
|
||||||
protected WorkingBeatmap IntroBeatmap;
|
protected WorkingBeatmap IntroBeatmap;
|
||||||
|
|
||||||
@ -57,6 +57,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
|
||||||
|
|
||||||
|
protected void StartTrack()
|
||||||
|
{
|
||||||
|
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
|
||||||
|
if (MenuMusic.Value)
|
||||||
|
Track.Restart();
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
|
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
|
||||||
{
|
{
|
||||||
@ -136,6 +143,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
if (!resuming)
|
if (!resuming)
|
||||||
{
|
{
|
||||||
|
Beatmap.Value = IntroBeatmap;
|
||||||
|
IntroBeatmap = null;
|
||||||
|
|
||||||
logo.MoveTo(new Vector2(0.5f));
|
logo.MoveTo(new Vector2(0.5f));
|
||||||
logo.ScaleTo(Vector2.One);
|
logo.ScaleTo(Vector2.One);
|
||||||
logo.Hide();
|
logo.Hide();
|
||||||
@ -156,6 +166,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnSuspending(IScreen next)
|
||||||
|
{
|
||||||
|
base.OnSuspending(next);
|
||||||
|
Track = null;
|
||||||
|
}
|
||||||
|
|
||||||
private MainMenu mainMenu;
|
private MainMenu mainMenu;
|
||||||
|
|
||||||
protected void PrepareMenuLoad()
|
protected void PrepareMenuLoad()
|
||||||
|
@ -55,9 +55,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
if (!resuming)
|
if (!resuming)
|
||||||
{
|
{
|
||||||
Beatmap.Value = IntroBeatmap;
|
|
||||||
IntroBeatmap = null;
|
|
||||||
|
|
||||||
PrepareMenuLoad();
|
PrepareMenuLoad();
|
||||||
|
|
||||||
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
|
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
|
||||||
@ -70,9 +67,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
AddInternal(t);
|
AddInternal(t);
|
||||||
Welcome?.Play();
|
Welcome?.Play();
|
||||||
|
|
||||||
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
|
StartTrack();
|
||||||
if (MenuMusic.Value)
|
|
||||||
Track.Start();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,12 +78,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
background.FadeOut(100);
|
background.FadeOut(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
|
||||||
{
|
|
||||||
Track = null;
|
|
||||||
base.OnSuspending(next);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TrianglesIntroSequence : CompositeDrawable
|
private class TrianglesIntroSequence : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly OsuLogo logo;
|
private readonly OsuLogo logo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user