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

Merge pull request #10087 from peppy/fix-toggle-pause-state

Fix pause/play operation sometimes displaying incorrectly on OSD
This commit is contained in:
Dan Balasescu 2020-09-08 22:58:07 +09:00 committed by GitHub
commit 4dd6594547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,9 +33,11 @@ namespace osu.Game.Overlays.Music
switch (action) switch (action)
{ {
case GlobalAction.MusicPlay: case GlobalAction.MusicPlay:
if (musicController.TogglePause()) // use previous state as TogglePause may not update the track's state immediately (state update is run on the audio thread see https://github.com/ppy/osu/issues/9880#issuecomment-674668842)
onScreenDisplay?.Display(new MusicActionToast(musicController.IsPlaying ? "Play track" : "Pause track")); bool wasPlaying = musicController.IsPlaying;
if (musicController.TogglePause())
onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? "Pause track" : "Play track"));
return true; return true;
case GlobalAction.MusicNext: case GlobalAction.MusicNext: