Update with keybinding changes

This commit is contained in:
smoogipoo
2021-09-16 18:26:12 +09:00
parent d3767ec4e9
commit f9d5abff8a
77 changed files with 302 additions and 257 deletions

View File

@ -228,9 +228,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
}
public bool OnPressed(PlatformAction action)
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
switch (action)
switch (e.Action)
{
case PlatformAction.SelectAll:
SelectAll();
@ -240,7 +240,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
}
public void OnReleased(PlatformAction action)
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}

View File

@ -137,9 +137,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <returns>Whether any items could be reversed.</returns>
public virtual bool HandleReverse() => false;
public bool OnPressed(PlatformAction action)
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
switch (action)
switch (e.Action)
{
case PlatformAction.Delete:
DeleteSelected();
@ -149,7 +149,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
}
public void OnReleased(PlatformAction action)
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}

View File

@ -4,6 +4,7 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Objects;
using osuTK;
@ -20,9 +21,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// for now we always allow movement. snapping is provided by the Timeline's "distance" snap implementation
public override bool HandleMovement(MoveSelectionEvent<HitObject> moveEvent) => true;
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.EditorNudgeLeft:
nudgeSelection(-1);
@ -36,7 +37,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Extensions;
@ -77,15 +78,15 @@ namespace osu.Game.Screens.Edit.Compose
#region Input Handling
public bool OnPressed(PlatformAction action)
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (action == PlatformAction.Copy)
if (e.Action == PlatformAction.Copy)
host.GetClipboard()?.SetText(formatSelectionAsString());
return false;
}
public void OnReleased(PlatformAction action)
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}

View File

@ -347,9 +347,9 @@ namespace osu.Game.Screens.Edit
clock.ProcessFrame();
}
public bool OnPressed(PlatformAction action)
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
switch (action)
switch (e.Action)
{
case PlatformAction.Cut:
Cut();
@ -379,7 +379,7 @@ namespace osu.Game.Screens.Edit
return false;
}
public void OnReleased(PlatformAction action)
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
@ -434,9 +434,9 @@ namespace osu.Game.Screens.Edit
return true;
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.Back:
// as we don't want to display the back button, manual handling of exit action is required.
@ -468,7 +468,7 @@ namespace osu.Game.Screens.Edit
}
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -218,9 +218,9 @@ namespace osu.Game.Screens.Menu
return base.OnKeyDown(e);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.Back:
return goBack();
@ -234,7 +234,7 @@ namespace osu.Game.Screens.Menu
}
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
@ -18,9 +19,9 @@ namespace osu.Game.Screens.Menu
{
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (action == GlobalAction.Back)
if (e.Action == GlobalAction.Back)
{
BeginConfirm();
return true;
@ -29,9 +30,9 @@ namespace osu.Game.Screens.Menu
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
if (action == GlobalAction.Back)
if (e.Action == GlobalAction.Back)
{
if (!Fired)
AbortConfirm();

View File

@ -141,29 +141,29 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
#region Key selection logic (shared with BeatmapCarousel)
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SelectNext:
beginRepeatSelection(() => selectNext(1), action);
beginRepeatSelection(() => selectNext(1), e.Action);
return true;
case GlobalAction.SelectPrevious:
beginRepeatSelection(() => selectNext(-1), action);
beginRepeatSelection(() => selectNext(-1), e.Action);
return true;
}
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SelectNext:
case GlobalAction.SelectPrevious:
endRepeatSelection(action);
endRepeatSelection(e.Action);
break;
}
}

View File

@ -132,12 +132,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
})
};
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (SelectedRoom.Value != Room)
return false;
switch (action)
switch (e.Action)
{
case GlobalAction.Select:
TriggerClick();
@ -147,7 +147,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
namespace osu.Game.Screens.OnlinePlay.Match.Components
{
@ -16,12 +17,12 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
Triangles.TriangleScale = 1.5f;
}
public bool OnPressed(PlatformAction action)
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (!Enabled.Value)
return false;
switch (action)
switch (e.Action)
{
case PlatformAction.DocumentNew:
// might as well also handle new tab. it's a bit of an undefined flow on this screen.
@ -33,7 +34,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
return false;
}
public void OnReleased(PlatformAction action)
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
}

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
@ -63,9 +64,9 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
Settings.Delay(TRANSITION_DURATION / 2).FadeOut(TRANSITION_DURATION / 2);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.Select:
if (IsLoading)
@ -86,7 +87,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -71,9 +71,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
}, true);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.ToggleChatFocus:
if (Textbox.HasFocus)
@ -94,7 +94,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -187,9 +187,9 @@ namespace osu.Game.Screens.Play
InternalButtons.Add(button);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SelectPrevious:
InternalButtons.SelectPrevious();
@ -211,7 +211,7 @@ namespace osu.Game.Screens.Play
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -206,9 +206,9 @@ namespace osu.Game.Screens.Play.HUD
base.OnHoverLost(e);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.Back:
case GlobalAction.PauseGameplay: // in the future this behaviour will differ for replays etc.
@ -220,9 +220,9 @@ namespace osu.Game.Screens.Play.HUD
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.Back:
case GlobalAction.PauseGameplay:

View File

@ -11,6 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
@ -280,9 +281,9 @@ namespace osu.Game.Screens.Play
protected PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay();
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.HoldForHUD:
holdingForHUD = true;
@ -311,9 +312,9 @@ namespace osu.Game.Screens.Play
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.HoldForHUD:
holdingForHUD = false;

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
@ -9,17 +10,17 @@ namespace osu.Game.Screens.Play
{
public class HotkeyExitOverlay : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction>
{
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (action != GlobalAction.QuickExit) return false;
if (e.Action != GlobalAction.QuickExit) return false;
BeginConfirm();
return true;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
if (action != GlobalAction.QuickExit) return;
if (e.Action != GlobalAction.QuickExit) return;
AbortConfirm();
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
@ -9,17 +10,17 @@ namespace osu.Game.Screens.Play
{
public class HotkeyRetryOverlay : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction>
{
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (action != GlobalAction.QuickRetry) return false;
if (e.Action != GlobalAction.QuickRetry) return false;
BeginConfirm();
return true;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
if (action != GlobalAction.QuickRetry) return;
if (e.Action != GlobalAction.QuickRetry) return;
AbortConfirm();
}

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Threading;
using osu.Game.Beatmaps;
using osu.Game.Extensions;
@ -49,11 +50,11 @@ namespace osu.Game.Screens.Play
private ScheduledDelegate keyboardSeekDelegate;
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
const double keyboard_seek_amount = 5000;
switch (action)
switch (e.Action)
{
case GlobalAction.SeekReplayBackward:
keyboardSeekDelegate?.Cancel();
@ -83,9 +84,9 @@ namespace osu.Game.Screens.Play
}
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SeekReplayBackward:
case GlobalAction.SeekReplayForward:

View File

@ -144,9 +144,9 @@ namespace osu.Game.Screens.Play
return base.OnMouseMove(e);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SkipCutscene:
if (!button.Enabled.Value)
@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -327,9 +328,9 @@ namespace osu.Game.Screens.Ranking
}
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.Select:
statisticsPanel.ToggleVisibility();
@ -339,7 +340,7 @@ namespace osu.Game.Screens.Ranking
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}

View File

@ -514,29 +514,29 @@ namespace osu.Game.Screens.Select
base.OnKeyUp(e);
}
public bool OnPressed(GlobalAction action)
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SelectNext:
beginRepeatSelection(() => SelectNext(1, false), action);
beginRepeatSelection(() => SelectNext(1, false), e.Action);
return true;
case GlobalAction.SelectPrevious:
beginRepeatSelection(() => SelectNext(-1, false), action);
beginRepeatSelection(() => SelectNext(-1, false), e.Action);
return true;
}
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (action)
switch (e.Action)
{
case GlobalAction.SelectNext:
case GlobalAction.SelectPrevious:
endRepeatSelection(action);
endRepeatSelection(e.Action);
break;
}
}

View File

@ -172,9 +172,9 @@ namespace osu.Game.Screens.Select
return base.OnClick(e);
}
public virtual bool OnPressed(GlobalAction action)
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (action == Hotkey)
if (e.Action == Hotkey)
{
TriggerClick();
return true;
@ -183,6 +183,6 @@ namespace osu.Game.Screens.Select
return false;
}
public virtual void OnReleased(GlobalAction action) { }
public virtual void OnReleased(KeyBindingReleaseEvent<GlobalAction> e) { }
}
}

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings;
@ -58,11 +59,11 @@ namespace osu.Game.Screens.Select
};
}
public override bool OnPressed(GlobalAction action)
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
rewindSearch = action == GlobalAction.SelectPreviousRandom;
rewindSearch = e.Action == GlobalAction.SelectPreviousRandom;
if (action != GlobalAction.SelectNextRandom && action != GlobalAction.SelectPreviousRandom)
if (e.Action != GlobalAction.SelectNextRandom && e.Action != GlobalAction.SelectPreviousRandom)
{
return false;
}
@ -71,9 +72,9 @@ namespace osu.Game.Screens.Select
return true;
}
public override void OnReleased(GlobalAction action)
public override void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
if (action == GlobalAction.SelectPreviousRandom)
if (e.Action == GlobalAction.SelectPreviousRandom)
{
rewindSearch = false;
}

View File

@ -812,11 +812,11 @@ namespace osu.Game.Screens.Select
Schedule(() => BeatmapDetails.Refresh())));
}
public virtual bool OnPressed(GlobalAction action)
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (!this.IsCurrentScreen()) return false;
switch (action)
switch (e.Action)
{
case GlobalAction.Select:
FinaliseSelection();
@ -826,7 +826,7 @@ namespace osu.Game.Screens.Select
return false;
}
public void OnReleased(GlobalAction action)
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}