mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09: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:
commit
98c992004b
@ -37,6 +37,7 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Game.Collections;
|
using osu.Game.Collections;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -519,7 +520,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
ModSelect.SelectedMods.BindTo(selectedMods);
|
ModSelect.SelectedMods.BindTo(selectedMods);
|
||||||
|
|
||||||
music.TrackChanged += ensureTrackLooping;
|
beginLooping();
|
||||||
}
|
}
|
||||||
|
|
||||||
private const double logo_transition = 250;
|
private const double logo_transition = 250;
|
||||||
@ -570,8 +571,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
BeatmapDetails.Refresh();
|
BeatmapDetails.Refresh();
|
||||||
|
|
||||||
music.CurrentTrack.Looping = true;
|
beginLooping();
|
||||||
music.TrackChanged += ensureTrackLooping;
|
|
||||||
music.ResetTrackAdjustments();
|
music.ResetTrackAdjustments();
|
||||||
|
|
||||||
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
||||||
@ -597,8 +597,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
BeatmapOptions.Hide();
|
BeatmapOptions.Hide();
|
||||||
|
|
||||||
music.CurrentTrack.Looping = false;
|
endLooping();
|
||||||
music.TrackChanged -= ensureTrackLooping;
|
|
||||||
|
|
||||||
this.ScaleTo(1.1f, 250, Easing.InSine);
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
|
|
||||||
@ -619,12 +618,33 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
FilterControl.Deactivate();
|
FilterControl.Deactivate();
|
||||||
|
|
||||||
music.CurrentTrack.Looping = false;
|
endLooping();
|
||||||
music.TrackChanged -= ensureTrackLooping;
|
|
||||||
|
|
||||||
return false;
|
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)
|
private void ensureTrackLooping(WorkingBeatmap beatmap, TrackChangeDirection changeDirection)
|
||||||
=> music.CurrentTrack.Looping = true;
|
=> music.CurrentTrack.Looping = true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user