Expose track from MusicController

This commit is contained in:
smoogipoo
2020-08-05 21:10:38 +09:00
parent 6e42b8219c
commit 5c05fe3988
39 changed files with 204 additions and 283 deletions

View File

@ -1,6 +1,7 @@
// 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.Diagnostics;
using System.Linq;
using osuTK;
using osuTK.Graphics;
@ -181,11 +182,12 @@ namespace osu.Game.Screens.Menu
if (last is IntroScreen && musicController.TrackLoaded)
{
// Todo: Wrong.
if (!musicController.IsPlaying)
Debug.Assert(musicController.CurrentTrack != null);
if (!musicController.CurrentTrack.IsRunning)
{
musicController.SeekTo(metadata.PreviewTime != -1 ? metadata.PreviewTime : 0.4f * musicController.TrackLength);
musicController.Play();
musicController.CurrentTrack.Seek(metadata.PreviewTime != -1 ? metadata.PreviewTime : 0.4f * musicController.CurrentTrack.Length);
musicController.CurrentTrack.Start();
}
}