Merge pull request #13962 from ekrctb/platform-action

Adapt to framework `PlatformAction` type change
This commit is contained in:
Dean Herbert 2021-07-21 18:17:38 +09:00 committed by GitHub
commit adda96ac86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 32 additions and 37 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.706.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.706.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.714.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2021.721.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. --> <!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

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;
} }

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.3.0" /> <PackageReference Include="Realm" Version="10.3.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.714.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.721.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.706.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.706.0" />
<PackageReference Include="Sentry" Version="3.6.0" /> <PackageReference Include="Sentry" Version="3.6.0" />
<PackageReference Include="SharpCompress" Version="0.28.3" /> <PackageReference Include="SharpCompress" Version="0.28.3" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.714.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2021.721.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.706.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.706.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -93,7 +93,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2021.714.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.721.0" />
<PackageReference Include="SharpCompress" Version="0.28.3" /> <PackageReference Include="SharpCompress" Version="0.28.3" />
<PackageReference Include="NUnit" Version="3.13.2" /> <PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />