1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix beatmap transfer not working

This commit is contained in:
Dean Herbert 2020-08-18 13:01:35 +09:00
parent 93a8bc3d5a
commit 083bcde3cf
2 changed files with 17 additions and 3 deletions

View File

@ -259,6 +259,13 @@ namespace osu.Game.Beatmaps
[NotNull]
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
/// <summary>
/// Transfer a valid audio track into this working beatmap. Used as an optimisation to avoid reload / track swap
/// across difficulties in the same beatmap set.
/// </summary>
/// <param name="track">The track to transfer.</param>
public void TransferTrack([NotNull] Track track) => loadedTrack = track ?? throw new ArgumentNullException(nameof(track));
/// <summary>
/// Get the loaded audio track instance. <see cref="LoadTrack"/> must have first been called.
/// This generally happens via MusicController when changing the global beatmap.

View File

@ -282,10 +282,10 @@ namespace osu.Game.Overlays
{
TrackChangeDirection direction = TrackChangeDirection.None;
bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current?.BeatmapInfo) ?? false;
if (current != null)
{
bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
if (audioEquals)
direction = TrackChangeDirection.None;
else if (queuedDirection.HasValue)
@ -305,8 +305,15 @@ namespace osu.Game.Overlays
current = beatmap.NewValue;
if (CurrentTrack.IsDummyDevice || !beatmap.OldValue.BeatmapInfo.AudioEquals(current?.BeatmapInfo))
if (!audioEquals || CurrentTrack.IsDummyDevice)
{
changeTrack();
}
else
{
// transfer still valid track to new working beatmap
current.TransferTrack(beatmap.OldValue.Track);
}
TrackChanged?.Invoke(current, direction);