1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 23:27:25 +08:00

Adapt to PlatformAction type change

This commit is contained in:
ekrctb 2021-07-20 14:23:34 +09:00
parent 747c475b95
commit 1bac471b49
8 changed files with 28 additions and 33 deletions

View File

@ -129,9 +129,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
public bool OnPressed(PlatformAction action)
{
switch (action.ActionMethod)
switch (action)
{
case PlatformActionMethod.Delete:
case PlatformAction.Delete:
return DeleteSelected();
}

View File

@ -330,15 +330,15 @@ namespace osu.Game.Tests.Visual.Online
InputManager.ReleaseKey(Key.AltLeft);
}
private void pressCloseDocumentKeys() => pressKeysFor(PlatformActionType.DocumentClose);
private void pressCloseDocumentKeys() => pressKeysFor(PlatformAction.DocumentClose);
private void pressNewTabKeys() => pressKeysFor(PlatformActionType.TabNew);
private void pressNewTabKeys() => pressKeysFor(PlatformAction.TabNew);
private void pressRestoreTabKeys() => pressKeysFor(PlatformActionType.TabRestore);
private void pressRestoreTabKeys() => pressKeysFor(PlatformAction.TabRestore);
private void pressKeysFor(PlatformActionType type)
private void pressKeysFor(PlatformAction type)
{
var binding = host.PlatformKeyBindings.First(b => ((PlatformAction)b.Action).ActionType == type);
var binding = host.PlatformKeyBindings.First(b => (PlatformAction)b.Action == type);
foreach (var k in binding.KeyCombination.Keys)
InputManager.PressKey((Key)k);

View File

@ -32,20 +32,15 @@ namespace osu.Game.Graphics.UserInterface
public override bool OnPressed(PlatformAction action)
{
switch (action.ActionType)
switch (action)
{
case PlatformActionType.LineEnd:
case PlatformActionType.LineStart:
return false;
case PlatformAction.MoveBackwardLine:
case PlatformAction.MoveForwardLine:
// Shift+delete is handled via PlatformAction on macOS. this is not so useful in the context of a SearchTextBox
// as we do not allow arrow key navigation in the first place (ie. the caret should always be at the end of text)
// Avoid handling it here to allow other components to potentially consume the shortcut.
case PlatformActionType.CharNext:
if (action.ActionMethod == PlatformActionMethod.Delete)
return false;
break;
case PlatformAction.DeleteForwardChar:
return false;
}
return base.OnPressed(action);

View File

@ -374,17 +374,17 @@ namespace osu.Game.Overlays
public bool OnPressed(PlatformAction action)
{
switch (action.ActionType)
switch (action)
{
case PlatformActionType.TabNew:
case PlatformAction.TabNew:
ChannelTabControl.SelectChannelSelectorTab();
return true;
case PlatformActionType.TabRestore:
case PlatformAction.TabRestore:
channelManager.JoinLastClosedChannel();
return true;
case PlatformActionType.DocumentClose:
case PlatformAction.DocumentClose:
channelManager.LeaveChannel(channelManager.CurrentChannel.Value);
return true;
}

View File

@ -230,9 +230,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
public bool OnPressed(PlatformAction action)
{
switch (action.ActionType)
switch (action)
{
case PlatformActionType.SelectAll:
case PlatformAction.SelectAll:
SelectAll();
return true;
}

View File

@ -139,9 +139,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
public bool OnPressed(PlatformAction action)
{
switch (action.ActionMethod)
switch (action)
{
case PlatformActionMethod.Delete:
case PlatformAction.Delete:
DeleteSelected();
return true;
}

View File

@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Compose
public bool OnPressed(PlatformAction action)
{
if (action.ActionType == PlatformActionType.Copy)
if (action == PlatformAction.Copy)
host.GetClipboard().SetText(formatSelectionAsString());
return false;

View File

@ -330,29 +330,29 @@ namespace osu.Game.Screens.Edit
public bool OnPressed(PlatformAction action)
{
switch (action.ActionType)
switch (action)
{
case PlatformActionType.Cut:
case PlatformAction.Cut:
Cut();
return true;
case PlatformActionType.Copy:
case PlatformAction.Copy:
Copy();
return true;
case PlatformActionType.Paste:
case PlatformAction.Paste:
Paste();
return true;
case PlatformActionType.Undo:
case PlatformAction.Undo:
Undo();
return true;
case PlatformActionType.Redo:
case PlatformAction.Redo:
Redo();
return true;
case PlatformActionType.Save:
case PlatformAction.Save:
Save();
return true;
}