mirror of
https://github.com/ppy/osu
synced 2025-01-10 16:19:47 +00:00
Fix MusicActionHandler unnecessarily depending on OnScreenDisplay's existance
This commit is contained in:
parent
b8e5acfef1
commit
33b76015d8
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Music
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
|
||||
[Resolved]
|
||||
[Resolved(canBeNull: true)]
|
||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
@ -34,14 +34,14 @@ namespace osu.Game.Overlays.Music
|
||||
{
|
||||
case GlobalAction.MusicPlay:
|
||||
if (musicController.TogglePause())
|
||||
onScreenDisplay.Display(new MusicActionToast(musicController.IsPlaying ? "Play track" : "Pause track"));
|
||||
onScreenDisplay?.Display(new MusicActionToast(musicController.IsPlaying ? "Play track" : "Pause track"));
|
||||
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicNext:
|
||||
musicController.NextTrack(() =>
|
||||
{
|
||||
onScreenDisplay.Display(new MusicActionToast("Next track"));
|
||||
onScreenDisplay?.Display(new MusicActionToast("Next track"));
|
||||
}).RunTask();
|
||||
|
||||
return true;
|
||||
@ -52,11 +52,11 @@ namespace osu.Game.Overlays.Music
|
||||
switch (res)
|
||||
{
|
||||
case PreviousTrackResult.Restart:
|
||||
onScreenDisplay.Display(new MusicActionToast("Restart track"));
|
||||
onScreenDisplay?.Display(new MusicActionToast("Restart track"));
|
||||
break;
|
||||
|
||||
case PreviousTrackResult.Previous:
|
||||
onScreenDisplay.Display(new MusicActionToast("Previous track"));
|
||||
onScreenDisplay?.Display(new MusicActionToast("Previous track"));
|
||||
break;
|
||||
}
|
||||
}).RunTask();
|
||||
|
Loading…
Reference in New Issue
Block a user