mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Use new platform actions instead of hardcoded keys
This commit is contained in:
parent
a91015302e
commit
e74fe68c96
@ -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;
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.W:
|
||||
channelManager.LeaveChannel(channelManager.CurrentChannel.Value);
|
||||
return true;
|
||||
|
||||
case Key.T:
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user