mirror of https://github.com/ppy/osu
Add global action for toggling now playing overlay (#7501)
Add global action for toggling now playing overlay
This commit is contained in:
commit
7a6215c6cf
|
@ -24,6 +24,7 @@ public GlobalActionContainer(OsuGameBase game)
|
|||
|
||||
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(InputKey.F6, GlobalAction.ToggleNowPlaying),
|
||||
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
|
||||
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
||||
new KeyBinding(InputKey.F10, GlobalAction.ToggleGameplayMouseButtons),
|
||||
|
@ -137,5 +138,8 @@ public enum GlobalAction
|
|||
|
||||
[Description("Play / pause")]
|
||||
MusicPlay,
|
||||
|
||||
[Description("Toggle now playing overlay")]
|
||||
ToggleNowPlaying,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ public class OsuGame : OsuGameBase, IKeyBindingHandler<GlobalAction>
|
|||
|
||||
private NotificationOverlay notifications;
|
||||
|
||||
private NowPlayingOverlay nowPlaying;
|
||||
|
||||
private DirectOverlay direct;
|
||||
|
||||
private SocialOverlay social;
|
||||
|
@ -624,7 +626,7 @@ protected override void LoadComplete()
|
|||
Origin = Anchor.TopRight,
|
||||
}, rightFloatingOverlayContent.Add, true);
|
||||
|
||||
loadComponentSingleFile(new NowPlayingOverlay
|
||||
loadComponentSingleFile(nowPlaying = new NowPlayingOverlay
|
||||
{
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Anchor = Anchor.TopRight,
|
||||
|
@ -822,6 +824,10 @@ public bool OnPressed(GlobalAction action)
|
|||
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.ToggleNowPlaying:
|
||||
nowPlaying.ToggleVisibility();
|
||||
return true;
|
||||
|
||||
case GlobalAction.ToggleChat:
|
||||
chatOverlay.ToggleVisibility();
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue