1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Add key binding to focus chat input

This commit is contained in:
Dean Herbert 2021-08-17 15:05:36 +09:00
parent 30eee363dc
commit 124f149cb5
2 changed files with 23 additions and 1 deletions

View File

@ -90,6 +90,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(InputKey.Left, GlobalAction.SeekReplayBackward), new KeyBinding(InputKey.Left, GlobalAction.SeekReplayBackward),
new KeyBinding(InputKey.Right, GlobalAction.SeekReplayForward), new KeyBinding(InputKey.Right, GlobalAction.SeekReplayForward),
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD), new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
new KeyBinding(InputKey.Tab, GlobalAction.FocusChatInput),
}; };
public IEnumerable<KeyBinding> SongSelectKeyBindings => new[] public IEnumerable<KeyBinding> SongSelectKeyBindings => new[]
@ -280,5 +281,8 @@ namespace osu.Game.Input.Bindings
[Description("Seek replay backward")] [Description("Seek replay backward")]
SeekReplayBackward, SeekReplayBackward,
[Description("Focus chat")]
FocusChatInput
} }
} }

View File

@ -4,12 +4,14 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings;
using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.OnlinePlay.Match.Components;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
namespace osu.Game.Screens.OnlinePlay.Multiplayer namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
public class GameplayChatDisplay : MatchChatDisplay public class GameplayChatDisplay : MatchChatDisplay, IKeyBindingHandler<GlobalAction>
{ {
[Resolved] [Resolved]
private ILocalUserPlayInfo localUserInfo { get; set; } private ILocalUserPlayInfo localUserInfo { get; set; }
@ -58,5 +60,21 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
Expanded.BindValueChanged(expandedChanged, true); Expanded.BindValueChanged(expandedChanged, true);
} }
public bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.FocusChatInput:
Textbox.TakeFocus();
return true;
}
return false;
}
public void OnReleased(GlobalAction action)
{
}
} }
} }