Fix intros playing incorrectly

This commit is contained in:
smoogipoo 2020-08-06 18:54:08 +09:00
parent 2e3ecf71c7
commit ef689d943a
4 changed files with 12 additions and 16 deletions

View File

@ -581,6 +581,8 @@ namespace osu.Game
ScreenStack.ScreenPushed += screenPushed; ScreenStack.ScreenPushed += screenPushed;
ScreenStack.ScreenExited += screenExited; ScreenStack.ScreenExited += screenExited;
loadComponentSingleFile(MusicController, Add);
loadComponentSingleFile(osuLogo, logo => loadComponentSingleFile(osuLogo, logo =>
{ {
logoContainer.Add(logo); logoContainer.Add(logo);
@ -602,8 +604,6 @@ namespace osu.Game
loadComponentSingleFile(new OnScreenDisplay(), Add, true); loadComponentSingleFile(new OnScreenDisplay(), Add, true);
loadComponentSingleFile(MusicController, Add);
loadComponentSingleFile(notifications.With(d => loadComponentSingleFile(notifications.With(d =>
{ {
d.GetToolbarHeight = () => ToolbarOffset; d.GetToolbarHeight = () => ToolbarOffset;

View File

@ -44,8 +44,7 @@ namespace osu.Game.Screens.Menu
private WorkingBeatmap initialBeatmap; private WorkingBeatmap initialBeatmap;
[Resolved] protected ITrack Track { get; private set; }
protected MusicController MusicController { get; private set; }
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1); private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
@ -62,6 +61,9 @@ namespace osu.Game.Screens.Menu
[Resolved] [Resolved]
private AudioManager audio { get; set; } private AudioManager audio { get; set; }
[Resolved]
private MusicController musicController { get; set; }
/// <summary> /// <summary>
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap. /// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
/// </summary> /// </summary>
@ -113,9 +115,7 @@ namespace osu.Game.Screens.Menu
if (setInfo != null) if (setInfo != null)
{ {
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
UsingThemedIntro = initialBeatmap.GetRealTrack().IsDummyDevice == false;
// Todo: Wrong.
UsingThemedIntro = MusicController.CurrentTrack?.IsDummyDevice == false;
} }
return UsingThemedIntro; return UsingThemedIntro;
@ -154,7 +154,7 @@ namespace osu.Game.Screens.Menu
{ {
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu. // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
if (UsingThemedIntro) if (UsingThemedIntro)
MusicController.Play(true); Track.Restart();
} }
protected override void LogoArriving(OsuLogo logo, bool resuming) protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -168,6 +168,7 @@ namespace osu.Game.Screens.Menu
if (!resuming) if (!resuming)
{ {
beatmap.Value = initialBeatmap; beatmap.Value = initialBeatmap;
Track = musicController.CurrentTrack;
logo.MoveTo(new Vector2(0.5f)); logo.MoveTo(new Vector2(0.5f));
logo.ScaleTo(Vector2.One); logo.ScaleTo(Vector2.One);

View File

@ -59,7 +59,7 @@ namespace osu.Game.Screens.Menu
LoadComponentAsync(new TrianglesIntroSequence(logo, background) LoadComponentAsync(new TrianglesIntroSequence(logo, background)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Clock = new FramedClock(UsingThemedIntro ? MusicController.CurrentTrack : null), Clock = new FramedClock(UsingThemedIntro ? (IAdjustableClock)Track : null),
LoadMenu = LoadMenu LoadMenu = LoadMenu
}, t => }, t =>
{ {

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Overlays;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
using osuTK.Graphics; using osuTK.Graphics;
@ -31,9 +30,6 @@ namespace osu.Game.Screens.Menu
Alpha = 0, Alpha = 0,
}; };
[Resolved]
private MusicController musicController { get; set; }
private BackgroundScreenDefault background; private BackgroundScreenDefault background;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -43,9 +39,6 @@ namespace osu.Game.Screens.Menu
welcome = audio.Samples.Get(@"Intro/Welcome/welcome"); welcome = audio.Samples.Get(@"Intro/Welcome/welcome");
pianoReverb = audio.Samples.Get(@"Intro/Welcome/welcome_piano"); pianoReverb = audio.Samples.Get(@"Intro/Welcome/welcome_piano");
if (musicController.CurrentTrack != null)
musicController.CurrentTrack.Looping = true;
} }
protected override void LogoArriving(OsuLogo logo, bool resuming) protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -54,6 +47,8 @@ namespace osu.Game.Screens.Menu
if (!resuming) if (!resuming)
{ {
Track.Looping = true;
LoadComponentAsync(new WelcomeIntroSequence LoadComponentAsync(new WelcomeIntroSequence
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both