mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:13:20 +08:00
Fix OSD occasionally display incorrect play/pause state
This commit is contained in:
parent
b1110e5e3a
commit
a46be45a71
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user