1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Use new platform actions instead of hardcoded keys

This commit is contained in:
Dean Herbert 2021-06-03 15:04:07 +09:00
parent a91015302e
commit e74fe68c96

View File

@ -24,13 +24,15 @@ using osu.Game.Overlays.Chat.Tabs;
using osuTK.Input;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Online;
namespace osu.Game.Overlays
{
public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler<PlatformAction>
{
public string IconTexture => "Icons/Hexacons/messaging";
public LocalisableString Title => ChatStrings.HeaderTitle;
@ -367,33 +369,31 @@ namespace osu.Game.Overlays
}
}
if (e.ControlPressed)
{
if (e.ShiftPressed)
{
switch (e.Key)
{
case Key.T:
channelManager.JoinLastClosedChannel();
return true;
}
}
else
{
switch (e.Key)
{
case Key.W:
channelManager.LeaveChannel(channelManager.CurrentChannel.Value);
return true;
return base.OnKeyDown(e);
}
case Key.T:
ChannelTabControl.SelectChannelSelectorTab();
return true;
}
}
public bool OnPressed(PlatformAction action)
{
switch (action.ActionType)
{
case PlatformActionType.TabNew:
ChannelTabControl.SelectChannelSelectorTab();
return true;
case PlatformActionType.TabRestore:
channelManager.JoinLastClosedChannel();
return true;
case PlatformActionType.DocumentClose:
channelManager.LeaveChannel(channelManager.CurrentChannel.Value);
return true;
}
return base.OnKeyDown(e);
return false;
}
public void OnReleased(PlatformAction action)
{
}
public override bool AcceptsFocus => true;