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

Ensure track is looping in song select immediately

This commit is contained in:
Bartłomiej Dach 2020-09-12 20:43:17 +02:00
parent 4cf4618bd1
commit f17b2f1359

View File

@ -517,6 +517,8 @@ namespace osu.Game.Screens.Select
FilterControl.Activate(); FilterControl.Activate();
ModSelect.SelectedMods.BindTo(selectedMods); ModSelect.SelectedMods.BindTo(selectedMods);
music.TrackChanged += ensureTrackLooping;
} }
private const double logo_transition = 250; private const double logo_transition = 250;
@ -568,6 +570,7 @@ namespace osu.Game.Screens.Select
BeatmapDetails.Refresh(); BeatmapDetails.Refresh();
music.CurrentTrack.Looping = true; music.CurrentTrack.Looping = true;
music.TrackChanged += ensureTrackLooping;
music.ResetTrackAdjustments(); music.ResetTrackAdjustments();
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
@ -593,6 +596,7 @@ namespace osu.Game.Screens.Select
BeatmapOptions.Hide(); BeatmapOptions.Hide();
music.CurrentTrack.Looping = false; music.CurrentTrack.Looping = false;
music.TrackChanged -= ensureTrackLooping;
this.ScaleTo(1.1f, 250, Easing.InSine); this.ScaleTo(1.1f, 250, Easing.InSine);
@ -614,10 +618,14 @@ namespace osu.Game.Screens.Select
FilterControl.Deactivate(); FilterControl.Deactivate();
music.CurrentTrack.Looping = false; music.CurrentTrack.Looping = false;
music.TrackChanged -= ensureTrackLooping;
return false; return false;
} }
private void ensureTrackLooping(WorkingBeatmap beatmap, TrackChangeDirection changeDirection)
=> music.CurrentTrack.Looping = true;
public override bool OnBackButton() public override bool OnBackButton()
{ {
if (ModSelect.State.Value == Visibility.Visible) if (ModSelect.State.Value == Visibility.Visible)
@ -653,8 +661,6 @@ namespace osu.Game.Screens.Select
beatmapInfoWedge.Beatmap = beatmap; beatmapInfoWedge.Beatmap = beatmap;
BeatmapDetails.Beatmap = beatmap; BeatmapDetails.Beatmap = beatmap;
music.CurrentTrack.Looping = true;
} }
private readonly WeakReference<ITrack> lastTrack = new WeakReference<ITrack>(null); private readonly WeakReference<ITrack> lastTrack = new WeakReference<ITrack>(null);