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 @@ protected override void LoadComplete()
ScreenStack.ScreenPushed += screenPushed;
ScreenStack.ScreenExited += screenExited;
loadComponentSingleFile(MusicController, Add);
loadComponentSingleFile(osuLogo, logo =>
{
logoContainer.Add(logo);
@ -602,8 +604,6 @@ protected override void LoadComplete()
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
loadComponentSingleFile(MusicController, Add);
loadComponentSingleFile(notifications.With(d =>
{
d.GetToolbarHeight = () => ToolbarOffset;

View File

@ -44,8 +44,7 @@ public abstract class IntroScreen : StartupScreen
private WorkingBeatmap initialBeatmap;
[Resolved]
protected MusicController MusicController { get; private set; }
protected ITrack Track { get; private set; }
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
@ -62,6 +61,9 @@ public abstract class IntroScreen : StartupScreen
[Resolved]
private AudioManager audio { get; set; }
[Resolved]
private MusicController musicController { get; set; }
/// <summary>
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
/// </summary>
@ -113,9 +115,7 @@ bool loadThemedIntro()
if (setInfo != null)
{
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
// Todo: Wrong.
UsingThemedIntro = MusicController.CurrentTrack?.IsDummyDevice == false;
UsingThemedIntro = initialBeatmap.GetRealTrack().IsDummyDevice == false;
}
return UsingThemedIntro;
@ -154,7 +154,7 @@ 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 (UsingThemedIntro)
MusicController.Play(true);
Track.Restart();
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -168,6 +168,7 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
if (!resuming)
{
beatmap.Value = initialBeatmap;
Track = musicController.CurrentTrack;
logo.MoveTo(new Vector2(0.5f));
logo.ScaleTo(Vector2.One);

View File

@ -59,7 +59,7 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
{
RelativeSizeAxes = Axes.Both,
Clock = new FramedClock(UsingThemedIntro ? MusicController.CurrentTrack : null),
Clock = new FramedClock(UsingThemedIntro ? (IAdjustableClock)Track : null),
LoadMenu = LoadMenu
}, t =>
{

View File

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