1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +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) public bool OnPressed(PlatformAction action)
{ {
switch (action.ActionMethod) switch (action)
{ {
case PlatformActionMethod.Delete: case PlatformAction.Delete:
return DeleteSelected(); return DeleteSelected();
} }

View File

@ -330,15 +330,15 @@ namespace osu.Game.Tests.Visual.Online
InputManager.ReleaseKey(Key.AltLeft); 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) foreach (var k in binding.KeyCombination.Keys)
InputManager.PressKey((Key)k); InputManager.PressKey((Key)k);

View File

@ -32,20 +32,15 @@ namespace osu.Game.Graphics.UserInterface
public override bool OnPressed(PlatformAction action) public override bool OnPressed(PlatformAction action)
{ {
switch (action.ActionType) switch (action)
{ {
case PlatformActionType.LineEnd: case PlatformAction.MoveBackwardLine:
case PlatformActionType.LineStart: case PlatformAction.MoveForwardLine:
return false;
// Shift+delete is handled via PlatformAction on macOS. this is not so useful in the context of a SearchTextBox // 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) // 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. // Avoid handling it here to allow other components to potentially consume the shortcut.
case PlatformActionType.CharNext: case PlatformAction.DeleteForwardChar:
if (action.ActionMethod == PlatformActionMethod.Delete) return false;
return false;
break;
} }
return base.OnPressed(action); return base.OnPressed(action);

View File

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

View File

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

View File

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

View File

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

View File

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