1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Merge pull request #5764 from peppy/unpause-on-selection-change

Unpause music when changing selection at song select
This commit is contained in:
Dan Balasescu 2019-08-19 13:26:00 +09:00 committed by GitHub
commit 2137cd411f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -92,6 +92,15 @@ namespace osu.Game.Overlays
});
}
/// <summary>
/// Start playing the current track (if not already playing).
/// </summary>
public void Play()
{
if (!IsPlaying)
TogglePause();
}
/// <summary>
/// Toggle pause / play.
/// </summary>

View File

@ -359,6 +359,7 @@ namespace osu.Game.Screens.Select
return;
beatmapNoDebounce = beatmap;
performUpdateSelected();
}
@ -586,10 +587,18 @@ namespace osu.Game.Screens.Select
{
Track track = Beatmap.Value.Track;
if ((!track.IsRunning || restart) && music?.IsUserPaused != true)
if (!track.IsRunning || restart)
{
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
track.Restart();
if (music != null)
{
// use the global music controller (when available) to cancel a potential local user paused state.
music.SeekTo(track.RestartPoint);
music.Play();
}
else
track.Restart();
}
}