1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-22 13:10:12 +08:00

Merge pull request #10660 from peppy/fix-song-select-first-track-looping

Fix looping mode not being set on first track after entering song select
This commit is contained in:
Dan Balasescu
2020-11-04 14:37:27 +09:00
committed by GitHub
Unverified
+27 -7
View File
@@ -37,6 +37,7 @@ using osu.Framework.Input.Bindings;
using osu.Game.Collections;
using osu.Game.Graphics.UserInterface;
using osu.Game.Scoring;
using System.Diagnostics;
namespace osu.Game.Screens.Select
{
@@ -519,7 +520,7 @@ namespace osu.Game.Screens.Select
ModSelect.SelectedMods.BindTo(selectedMods);
music.TrackChanged += ensureTrackLooping;
beginLooping();
}
private const double logo_transition = 250;
@@ -570,8 +571,7 @@ namespace osu.Game.Screens.Select
BeatmapDetails.Refresh();
music.CurrentTrack.Looping = true;
music.TrackChanged += ensureTrackLooping;
beginLooping();
music.ResetTrackAdjustments();
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
@@ -597,8 +597,7 @@ namespace osu.Game.Screens.Select
BeatmapOptions.Hide();
music.CurrentTrack.Looping = false;
music.TrackChanged -= ensureTrackLooping;
endLooping();
this.ScaleTo(1.1f, 250, Easing.InSine);
@@ -619,12 +618,33 @@ namespace osu.Game.Screens.Select
FilterControl.Deactivate();
music.CurrentTrack.Looping = false;
music.TrackChanged -= ensureTrackLooping;
endLooping();
return false;
}
private bool isHandlingLooping;
private void beginLooping()
{
Debug.Assert(!isHandlingLooping);
music.CurrentTrack.Looping = isHandlingLooping = true;
music.TrackChanged += ensureTrackLooping;
}
private void endLooping()
{
// may be called multiple times during screen exit process.
if (!isHandlingLooping)
return;
music.CurrentTrack.Looping = isHandlingLooping = false;
music.TrackChanged -= ensureTrackLooping;
}
private void ensureTrackLooping(WorkingBeatmap beatmap, TrackChangeDirection changeDirection)
=> music.CurrentTrack.Looping = true;