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

Added ctrl + w and ctrl + t keyboard shortcuts

This commit is contained in:
Jess Meng 2020-12-11 21:52:36 -08:00
parent 9064ca9064
commit 92cab12eb7

View File

@ -25,6 +25,9 @@ using osuTK.Input;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using System;
using osu.Game.Input.Bindings;
namespace osu.Game.Overlays
{
public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
@ -333,6 +336,16 @@ namespace osu.Game.Overlays
ChannelTabControl.Current.Value = channel;
}
private void selectChannelSelectorTab()
{
int i = 0;
var channel = ChannelTabControl.Items
.Where(tab => (tab is ChannelSelectorTabItem.ChannelSelectorTabChannel))
.ElementAtOrDefault(i);
if (channel != null)
ChannelTabControl.Current.Value = channel;
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.AltPressed)
@ -356,6 +369,18 @@ namespace osu.Game.Overlays
return true;
}
}
if (e.ControlPressed)
{
switch (e.Key)
{
case Key.W:
channelManager.LeaveChannel(channelManager.CurrentChannel.Value);
return true;
case Key.T:
selectChannelSelectorTab();
return true;
}
}
return base.OnKeyDown(e);
}
@ -392,6 +417,7 @@ namespace osu.Game.Overlays
private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Add: