1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

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

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK; using osuTK;
@ -61,9 +62,9 @@ namespace osu.Game.Rulesets.Pippidon.UI
} }
} }
public bool OnPressed(PippidonAction action) public bool OnPressed(KeyBindingPressEvent<PippidonAction> e)
{ {
switch (action) switch (e.Action)
{ {
case PippidonAction.MoveUp: case PippidonAction.MoveUp:
changeLane(-1); changeLane(-1);
@ -78,7 +79,7 @@ namespace osu.Game.Rulesets.Pippidon.UI
} }
} }
public void OnReleased(PippidonAction action) public void OnReleased(KeyBindingReleaseEvent<PippidonAction> e)
{ {
} }

View File

@ -44,9 +44,9 @@ namespace osu.Game.Rulesets.Catch.Mods
} }
// disable keyboard controls // disable keyboard controls
public bool OnPressed(CatchAction action) => true; public bool OnPressed(KeyBindingPressEvent<CatchAction> e) => true;
public void OnReleased(CatchAction action) public void OnReleased(KeyBindingReleaseEvent<CatchAction> e)
{ {
} }

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Catch.Objects.Drawables; using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Catch.Replays;
@ -144,9 +145,9 @@ namespace osu.Game.Rulesets.Catch.UI
Catcher.VisualDirection = Direction.Left; Catcher.VisualDirection = Direction.Left;
} }
public bool OnPressed(CatchAction action) public bool OnPressed(KeyBindingPressEvent<CatchAction> e)
{ {
switch (action) switch (e.Action)
{ {
case CatchAction.MoveLeft: case CatchAction.MoveLeft:
currentDirection--; currentDirection--;
@ -164,9 +165,9 @@ namespace osu.Game.Rulesets.Catch.UI
return false; return false;
} }
public void OnReleased(CatchAction action) public void OnReleased(KeyBindingReleaseEvent<CatchAction> e)
{ {
switch (action) switch (e.Action)
{ {
case CatchAction.MoveLeft: case CatchAction.MoveLeft:
currentDirection++; currentDirection++;

View File

@ -7,6 +7,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Mania.Skinning.Default; using osu.Game.Rulesets.Mania.Skinning.Default;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -253,12 +254,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
HoldBrokenTime = Time.Current; HoldBrokenTime = Time.Current;
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (AllJudged) if (AllJudged)
return false; return false;
if (action != Action.Value) if (e.Action != Action.Value)
return false; return false;
// do not run any of this logic when rewinding, as it inverts order of presses/releases. // do not run any of this logic when rewinding, as it inverts order of presses/releases.
@ -288,12 +289,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
isHitting.Value = true; isHitting.Value = true;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
if (AllJudged) if (AllJudged)
return; return;
if (action != Action.Value) if (e.Action != Action.Value)
return; return;
// do not run any of this logic when rewinding, as it inverts order of presses/releases. // do not run any of this logic when rewinding, as it inverts order of presses/releases.

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
@ -43,9 +44,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
// it will be hidden along with its parenting hold note when required. // it will be hidden along with its parenting hold note when required.
} }
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note public override bool OnPressed(KeyBindingPressEvent<ManiaAction> e) => false; // Handled by the hold note
public override void OnReleased(ManiaAction action) public override void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
} }
} }

View File

@ -3,6 +3,7 @@
using System.Diagnostics; using System.Diagnostics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
@ -68,9 +69,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}); });
} }
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note public override bool OnPressed(KeyBindingPressEvent<ManiaAction> e) => false; // Handled by the hold note
public override void OnReleased(ManiaAction action) public override void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
} }
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Configuration;
@ -97,9 +98,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
ApplyResult(r => r.Type = result); ApplyResult(r => r.Type = result);
} }
public virtual bool OnPressed(ManiaAction action) public virtual bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action != Action.Value) if (e.Action != Action.Value)
return false; return false;
if (CheckHittable?.Invoke(this, Time.Current) == false) if (CheckHittable?.Invoke(this, Time.Current) == false)
@ -108,7 +109,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
return UpdateResult(true); return UpdateResult(true);
} }
public virtual void OnReleased(ManiaAction action) public virtual void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
} }

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -76,9 +77,9 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
} }
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action == Column.Action.Value) if (e.Action == Column.Action.Value)
{ {
light.FadeIn(); light.FadeIn();
light.ScaleTo(Vector2.One); light.ScaleTo(Vector2.One);
@ -87,12 +88,12 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
return false; return false;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
// Todo: Should be 400 * 100 / CurrentBPM // Todo: Should be 400 * 100 / CurrentBPM
const double animation_length = 250; const double animation_length = 250;
if (action == Column.Action.Value) if (e.Action == Column.Action.Value)
{ {
light.FadeTo(0, animation_length); light.FadeTo(0, animation_length);
light.ScaleTo(new Vector2(1, 0), animation_length); light.ScaleTo(new Vector2(1, 0), animation_length);

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -86,9 +87,9 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
} }
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action == column.Action.Value) if (e.Action == column.Action.Value)
{ {
upSprite.FadeTo(0); upSprite.FadeTo(0);
downSprite.FadeTo(1); downSprite.FadeTo(1);
@ -97,9 +98,9 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
return false; return false;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
if (action == column.Action.Value) if (e.Action == column.Action.Value)
{ {
upSprite.Delay(LegacyHitExplosion.FADE_IN_DURATION).FadeTo(1); upSprite.Delay(LegacyHitExplosion.FADE_IN_DURATION).FadeTo(1);
downSprite.Delay(LegacyHitExplosion.FADE_IN_DURATION).FadeTo(0); downSprite.Delay(LegacyHitExplosion.FADE_IN_DURATION).FadeTo(0);

View File

@ -10,6 +10,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Pooling;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.UI.Components; using osu.Game.Rulesets.Mania.UI.Components;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
@ -122,16 +123,16 @@ namespace osu.Game.Rulesets.Mania.UI
HitObjectArea.Explosions.Add(hitExplosionPool.Get(e => e.Apply(result))); HitObjectArea.Explosions.Add(hitExplosionPool.Get(e => e.Apply(result)));
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action != Action.Value) if (e.Action != Action.Value)
return false; return false;
sampleTriggerSource.Play(); sampleTriggerSource.Play();
return true; return true;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osuTK.Graphics; using osuTK.Graphics;
@ -91,16 +92,16 @@ namespace osu.Game.Rulesets.Mania.UI.Components
direction.Value == ScrollingDirection.Up ? dimPoint : brightPoint); direction.Value == ScrollingDirection.Up ? dimPoint : brightPoint);
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action == this.action.Value) if (e.Action == action.Value)
backgroundOverlay.FadeTo(1, 50, Easing.OutQuint).Then().FadeTo(0.5f, 250, Easing.OutQuint); backgroundOverlay.FadeTo(1, 50, Easing.OutQuint).Then().FadeTo(0.5f, 250, Easing.OutQuint);
return false; return false;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
if (action == this.action.Value) if (e.Action == action.Value)
backgroundOverlay.FadeTo(0, 250, Easing.OutQuint); backgroundOverlay.FadeTo(0, 250, Easing.OutQuint);
} }
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osuTK.Graphics; using osuTK.Graphics;
@ -74,16 +75,16 @@ namespace osu.Game.Rulesets.Mania.UI.Components
} }
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action == column.Action.Value) if (e.Action == column.Action.Value)
backgroundOverlay.FadeTo(1, 50, Easing.OutQuint).Then().FadeTo(0.5f, 250, Easing.OutQuint); backgroundOverlay.FadeTo(1, 50, Easing.OutQuint).Then().FadeTo(0.5f, 250, Easing.OutQuint);
return false; return false;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
if (action == column.Action.Value) if (e.Action == column.Action.Value)
backgroundOverlay.FadeTo(0, 250, Easing.OutQuint); backgroundOverlay.FadeTo(0, 250, Easing.OutQuint);
} }
} }

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -101,16 +102,16 @@ namespace osu.Game.Rulesets.Mania.UI.Components
} }
} }
public bool OnPressed(ManiaAction action) public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{ {
if (action == column.Action.Value) if (e.Action == column.Action.Value)
keyIcon.ScaleTo(1.4f, 50, Easing.OutQuint).Then().ScaleTo(1.3f, 250, Easing.OutQuint); keyIcon.ScaleTo(1.4f, 50, Easing.OutQuint).Then().ScaleTo(1.3f, 250, Easing.OutQuint);
return false; return false;
} }
public void OnReleased(ManiaAction action) public void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{ {
if (action == column.Action.Value) if (e.Action == column.Action.Value)
keyIcon.ScaleTo(1f, 125, Easing.OutQuint); keyIcon.ScaleTo(1f, 125, Easing.OutQuint);
} }
} }

View File

@ -127,9 +127,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
return false; return false;
} }
public bool OnPressed(PlatformAction action) public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{ {
switch (action) switch (e.Action)
{ {
case PlatformAction.Delete: case PlatformAction.Delete:
return DeleteSelected(); return DeleteSelected();
@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
return false; return false;
} }
public void OnReleased(PlatformAction action) public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{ {
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Judgements;
@ -228,15 +229,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
CornerExponent = 2; CornerExponent = 2;
} }
public bool OnPressed(OsuAction action) public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
{ {
switch (action) switch (e.Action)
{ {
case OsuAction.LeftButton: case OsuAction.LeftButton:
case OsuAction.RightButton: case OsuAction.RightButton:
if (IsHovered && (Hit?.Invoke() ?? false)) if (IsHovered && (Hit?.Invoke() ?? false))
{ {
HitAction = action; HitAction = e.Action;
return true; return true;
} }
@ -246,7 +247,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
return false; return false;
} }
public void OnReleased(OsuAction action) public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
{ {
} }
} }

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Configuration;
@ -115,9 +116,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
(ActiveCursor as OsuCursor)?.Contract(); (ActiveCursor as OsuCursor)?.Contract();
} }
public bool OnPressed(OsuAction action) public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
{ {
switch (action) switch (e.Action)
{ {
case OsuAction.LeftButton: case OsuAction.LeftButton:
case OsuAction.RightButton: case OsuAction.RightButton:
@ -129,9 +130,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
return false; return false;
} }
public void OnReleased(OsuAction action) public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
{ {
switch (action) switch (e.Action)
{ {
case OsuAction.LeftButton: case OsuAction.LeftButton:
case OsuAction.RightButton: case OsuAction.RightButton:

View File

@ -89,9 +89,9 @@ namespace osu.Game.Rulesets.Osu.UI
base.OnHoverLost(e); base.OnHoverLost(e);
} }
public bool OnPressed(OsuAction action) public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
{ {
switch (action) switch (e.Action)
{ {
case OsuAction.LeftButton: case OsuAction.LeftButton:
case OsuAction.RightButton: case OsuAction.RightButton:
@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.UI
return false; return false;
} }
public void OnReleased(OsuAction action) public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
{ {
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -37,6 +38,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
Result.Type = Type; Result.Type = Type;
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
} }
} }

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Linq; using System.Linq;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables;
@ -30,6 +31,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
nestedStrongHit.Result.Type = hitBoth ? Type : HitResult.Miss; nestedStrongHit.Result.Type = hitBoth ? Type : HitResult.Miss;
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
} }
} }

View File

@ -11,6 +11,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -112,7 +113,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollBody), protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollBody),
_ => new ElongatedCirclePiece()); _ => new ElongatedCirclePiece());
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
private void onNewResult(DrawableHitObject obj, JudgementResult result) private void onNewResult(DrawableHitObject obj, JudgementResult result)
{ {
@ -196,7 +197,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult); ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
} }
} }
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning.Default; using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -61,9 +62,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
} }
public override bool OnPressed(TaikoAction action) public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
JudgementType = action == TaikoAction.LeftRim || action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre; JudgementType = e.Action == TaikoAction.LeftRim || e.Action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
return UpdateResult(true); return UpdateResult(true);
} }
@ -91,7 +92,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult); ApplyResult(r => r.Type = ParentHitObject.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
} }
} }
} }

View File

@ -8,6 +8,7 @@ using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -145,19 +146,19 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = result); ApplyResult(r => r.Type = result);
} }
public override bool OnPressed(TaikoAction action) public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
if (pressHandledThisFrame) if (pressHandledThisFrame)
return true; return true;
if (Judged) if (Judged)
return false; return false;
validActionPressed = HitActions.Contains(action); validActionPressed = HitActions.Contains(e.Action);
// Only count this as handled if the new judgement is a hit // Only count this as handled if the new judgement is a hit
var result = UpdateResult(true); var result = UpdateResult(true);
if (IsHit) if (IsHit)
HitAction = action; HitAction = e.Action;
// Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded // Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded
// E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note // E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note
@ -165,11 +166,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return result; return result;
} }
public override void OnReleased(TaikoAction action) public override void OnReleased(KeyBindingReleaseEvent<TaikoAction> e)
{ {
if (action == HitAction) if (e.Action == HitAction)
HitAction = null; HitAction = null;
base.OnReleased(action); base.OnReleased(e);
} }
protected override void Update() protected override void Update()
@ -265,7 +266,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = r.Judgement.MaxResult); ApplyResult(r => r.Type = r.Judgement.MaxResult);
} }
public override bool OnPressed(TaikoAction action) public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
// Don't process actions until the main hitobject is hit // Don't process actions until the main hitobject is hit
if (!ParentHitObject.IsHit) if (!ParentHitObject.IsHit)
@ -276,7 +277,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return false; return false;
// Don't handle invalid hit action presses // Don't handle invalid hit action presses
if (!ParentHitObject.HitActions.Contains(action)) if (!ParentHitObject.HitActions.Contains(e.Action))
return false; return false;
return UpdateResult(true); return UpdateResult(true);

View File

@ -12,6 +12,7 @@ using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Skinning.Default; using osu.Game.Rulesets.Taiko.Skinning.Default;
@ -266,13 +267,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
private bool? lastWasCentre; private bool? lastWasCentre;
public override bool OnPressed(TaikoAction action) public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
// Don't handle keys before the swell starts // Don't handle keys before the swell starts
if (Time.Current < HitObject.StartTime) if (Time.Current < HitObject.StartTime)
return false; return false;
var isCentre = action == TaikoAction.LeftCentre || action == TaikoAction.RightCentre; var isCentre = e.Action == TaikoAction.LeftCentre || e.Action == TaikoAction.RightCentre;
// Ensure alternating centre and rim hits // Ensure alternating centre and rim hits
if (lastWasCentre == isCentre) if (lastWasCentre == isCentre)

View File

@ -3,6 +3,7 @@
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Taiko.Skinning.Default; using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
} }
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(KeyBindingPressEvent<TaikoAction> e) => false;
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick), protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
_ => new TickPiece()); _ => new TickPiece());

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -76,9 +77,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary> /// </summary>
public Drawable CreateProxiedContent() => proxiedContent.CreateProxy(); public Drawable CreateProxiedContent() => proxiedContent.CreateProxy();
public abstract bool OnPressed(TaikoAction action); public abstract bool OnPressed(KeyBindingPressEvent<TaikoAction> e);
public virtual void OnReleased(TaikoAction action) public virtual void OnReleased(KeyBindingReleaseEvent<TaikoAction> e)
{ {
} }

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.UI; using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -141,16 +142,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
Centre.Texture = skin.GetTexture(@"taiko-drum-inner"); Centre.Texture = skin.GetTexture(@"taiko-drum-inner");
} }
public bool OnPressed(TaikoAction action) public bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
Drawable target = null; Drawable target = null;
if (action == CentreAction) if (e.Action == CentreAction)
{ {
target = Centre; target = Centre;
sampleTriggerSource.Play(HitType.Centre); sampleTriggerSource.Play(HitType.Centre);
} }
else if (action == RimAction) else if (e.Action == RimAction)
{ {
target = Rim; target = Rim;
sampleTriggerSource.Play(HitType.Rim); sampleTriggerSource.Play(HitType.Rim);
@ -173,7 +174,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
return false; return false;
} }
public void OnReleased(TaikoAction action) public void OnReleased(KeyBindingReleaseEvent<TaikoAction> e)
{ {
} }
} }

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -151,19 +152,19 @@ namespace osu.Game.Rulesets.Taiko.UI
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private GameplayClock gameplayClock { get; set; } private GameplayClock gameplayClock { get; set; }
public bool OnPressed(TaikoAction action) public bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
{ {
Drawable target = null; Drawable target = null;
Drawable back = null; Drawable back = null;
if (action == CentreAction) if (e.Action == CentreAction)
{ {
target = centreHit; target = centreHit;
back = centre; back = centre;
sampleTriggerSource.Play(HitType.Centre); sampleTriggerSource.Play(HitType.Centre);
} }
else if (action == RimAction) else if (e.Action == RimAction)
{ {
target = rimHit; target = rimHit;
back = rim; back = rim;
@ -195,7 +196,7 @@ namespace osu.Game.Rulesets.Taiko.UI
return false; return false;
} }
public void OnReleased(TaikoAction action) public void OnReleased(KeyBindingReleaseEvent<TaikoAction> e)
{ {
} }
} }

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
@ -80,13 +81,13 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
public bool ReceivedAction; public bool ReceivedAction;
public bool OnPressed(TestAction action) public bool OnPressed(KeyBindingPressEvent<TestAction> e)
{ {
ReceivedAction = action == TestAction.Down; ReceivedAction = e.Action == TestAction.Down;
return true; return true;
} }
public void OnReleased(TestAction action) public void OnReleased(KeyBindingReleaseEvent<TestAction> e)
{ {
} }
} }

View File

@ -226,13 +226,13 @@ namespace osu.Game.Tests.Visual.Gameplay
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
public bool OnPressed(TestAction action) public bool OnPressed(KeyBindingPressEvent<TestAction> e)
{ {
box.Colour = Color4.White; box.Colour = Color4.White;
return true; return true;
} }
public void OnReleased(TestAction action) public void OnReleased(KeyBindingReleaseEvent<TestAction> e)
{ {
box.Colour = Color4.Black; box.Colour = Color4.Black;
} }

View File

@ -159,13 +159,13 @@ namespace osu.Game.Tests.Visual.Gameplay
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
public bool OnPressed(TestAction action) public bool OnPressed(KeyBindingPressEvent<TestAction> e)
{ {
box.Colour = Color4.White; box.Colour = Color4.White;
return true; return true;
} }
public void OnReleased(TestAction action) public void OnReleased(KeyBindingReleaseEvent<TestAction> e)
{ {
box.Colour = Color4.Black; box.Colour = Color4.Black;
} }

View File

@ -279,13 +279,13 @@ namespace osu.Game.Tests.Visual.Gameplay
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
public bool OnPressed(TestAction action) public bool OnPressed(KeyBindingPressEvent<TestAction> e)
{ {
box.Colour = Color4.White; box.Colour = Color4.White;
return true; return true;
} }
public void OnReleased(TestAction action) public void OnReleased(KeyBindingReleaseEvent<TestAction> e)
{ {
box.Colour = Color4.Black; box.Colour = Color4.Black;
} }

View File

@ -88,9 +88,9 @@ namespace osu.Game.Graphics.Containers
base.OnMouseUp(e); base.OnMouseUp(e);
} }
public virtual bool OnPressed(GlobalAction action) public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
Hide(); Hide();
@ -103,7 +103,7 @@ namespace osu.Game.Graphics.Containers
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -12,6 +12,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -57,9 +58,9 @@ namespace osu.Game.Graphics
shutter = audio.Samples.Get("UI/shutter"); shutter = audio.Samples.Get("UI/shutter");
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.TakeScreenshot: case GlobalAction.TakeScreenshot:
shutter.Play(); shutter.Play();
@ -70,7 +71,7 @@ namespace osu.Game.Graphics
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -61,9 +62,9 @@ namespace osu.Game.Graphics.UserInterface
{ {
public Action OnBackPressed; public Action OnBackPressed;
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
OnBackPressed?.Invoke(); OnBackPressed?.Invoke();
@ -73,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }
} }

View File

@ -70,11 +70,11 @@ namespace osu.Game.Graphics.UserInterface
return base.OnKeyDown(e); return base.OnKeyDown(e);
} }
public virtual bool OnPressed(GlobalAction action) public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (!HasFocus) return false; if (!HasFocus) return false;
if (action == GlobalAction.Back) if (e.Action == GlobalAction.Back)
{ {
if (Text.Length > 0) if (Text.Length > 0)
{ {
@ -86,7 +86,7 @@ namespace osu.Game.Graphics.UserInterface
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -30,9 +30,9 @@ namespace osu.Game.Graphics.UserInterface
PlaceholderText = "type to search"; PlaceholderText = "type to search";
} }
public override bool OnPressed(PlatformAction action) public override bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{ {
switch (action) switch (e.Action)
{ {
case PlatformAction.MoveBackwardLine: case PlatformAction.MoveBackwardLine:
case PlatformAction.MoveForwardLine: case PlatformAction.MoveForwardLine:
@ -43,7 +43,7 @@ namespace osu.Game.Graphics.UserInterface
return false; return false;
} }
return base.OnPressed(action); return base.OnPressed(e);
} }
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays; using osu.Game.Overlays;
using osuTK; using osuTK;
@ -55,12 +56,12 @@ namespace osu.Game.Graphics.UserInterfaceV2
this.FadeOut(fade_duration, Easing.OutQuint); this.FadeOut(fade_duration, Easing.OutQuint);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (State.Value == Visibility.Hidden) if (State.Value == Visibility.Hidden)
return false; return false;
if (action == GlobalAction.Back) if (e.Action == GlobalAction.Back)
{ {
Hide(); Hide();
return true; return true;
@ -69,7 +70,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }
} }

View File

@ -55,13 +55,13 @@ namespace osu.Game.Input
isIdle.Value = TimeSpentIdle > timeToIdle && AllowIdle; isIdle.Value = TimeSpentIdle > timeToIdle && AllowIdle;
} }
public bool OnPressed(PlatformAction action) => updateLastInteractionTime(); public bool OnPressed(KeyBindingPressEvent<PlatformAction> e) => updateLastInteractionTime();
public void OnReleased(PlatformAction action) => updateLastInteractionTime(); public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e) => updateLastInteractionTime();
public bool OnPressed(GlobalAction action) => updateLastInteractionTime(); public bool OnPressed(KeyBindingPressEvent<GlobalAction> e) => updateLastInteractionTime();
public void OnReleased(GlobalAction action) => updateLastInteractionTime(); public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e) => updateLastInteractionTime();
protected override bool Handle(UIEvent e) protected override bool Handle(UIEvent e)
{ {

View File

@ -27,6 +27,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Collections; using osu.Game.Collections;
@ -968,11 +969,11 @@ namespace osu.Game
return component; return component;
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (introScreen == null) return false; if (introScreen == null) return false;
switch (action) switch (e.Action)
{ {
case GlobalAction.ResetInputSettings: case GlobalAction.ResetInputSettings:
Host.ResetInputHandlers(); Host.ResetInputHandlers();
@ -1006,7 +1007,7 @@ namespace osu.Game
#endregion #endregion
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -186,9 +186,9 @@ namespace osu.Game.Overlays.BeatmapListing
return true; return true;
} }
public override bool OnPressed(GlobalAction action) public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (!base.OnPressed(action)) if (!base.OnPressed(e))
return false; return false;
TextChanged?.Invoke(); TextChanged?.Invoke();

View File

@ -10,6 +10,7 @@ using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
@ -91,9 +92,9 @@ namespace osu.Game.Overlays
Show(); Show();
} }
public override bool OnPressed(GlobalAction action) public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
if (Current.Value == null) if (Current.Value == null)

View File

@ -372,9 +372,9 @@ namespace osu.Game.Overlays
return base.OnKeyDown(e); return base.OnKeyDown(e);
} }
public bool OnPressed(PlatformAction action) public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{ {
switch (action) switch (e.Action)
{ {
case PlatformAction.TabNew: case PlatformAction.TabNew:
ChannelTabControl.SelectChannelSelectorTab(); ChannelTabControl.SelectChannelSelectorTab();
@ -392,7 +392,7 @@ namespace osu.Game.Overlays
return false; return false;
} }
public void OnReleased(PlatformAction action) public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{ {
} }

View File

@ -7,6 +7,7 @@ using osu.Game.Overlays.Dialog;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using System.Linq; using System.Linq;
using osu.Framework.Input.Events;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -83,16 +84,16 @@ namespace osu.Game.Overlays
this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine); this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine);
} }
public override bool OnPressed(GlobalAction action) public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Select: case GlobalAction.Select:
CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick(); CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick();
return true; return true;
} }
return base.OnPressed(action); return base.OnPressed(e);
} }
} }
} }

View File

@ -416,7 +416,7 @@ namespace osu.Game.Overlays.Mods
return base.OnKeyDown(e); return base.OnKeyDown(e);
} }
public override bool OnPressed(GlobalAction action) => false; // handled by back button public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e) => false; // handled by back button
private void updateAvailableMods() private void updateAvailableMods()
{ {

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
@ -26,23 +27,23 @@ namespace osu.Game.Overlays.Music
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private OnScreenDisplay onScreenDisplay { get; set; } private OnScreenDisplay onScreenDisplay { get; set; }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (beatmap.Disabled) if (beatmap.Disabled)
return false; return false;
switch (action) switch (e.Action)
{ {
case GlobalAction.MusicPlay: case GlobalAction.MusicPlay:
// use previous state as TogglePause may not update the track's state immediately (state update is run on the audio thread see https://github.com/ppy/osu/issues/9880#issuecomment-674668842) // use previous state as TogglePause may not update the track's state immediately (state update is run on the audio thread see https://github.com/ppy/osu/issues/9880#issuecomment-674668842)
bool wasPlaying = musicController.IsPlaying; bool wasPlaying = musicController.IsPlaying;
if (musicController.TogglePause()) if (musicController.TogglePause())
onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? "Pause track" : "Play track", action)); onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? "Pause track" : "Play track", e.Action));
return true; return true;
case GlobalAction.MusicNext: case GlobalAction.MusicNext:
musicController.NextTrack(() => onScreenDisplay?.Display(new MusicActionToast("Next track", action))); musicController.NextTrack(() => onScreenDisplay?.Display(new MusicActionToast("Next track", e.Action)));
return true; return true;
@ -52,11 +53,11 @@ namespace osu.Game.Overlays.Music
switch (res) switch (res)
{ {
case PreviousTrackResult.Restart: case PreviousTrackResult.Restart:
onScreenDisplay?.Display(new MusicActionToast("Restart track", action)); onScreenDisplay?.Display(new MusicActionToast("Restart track", e.Action));
break; break;
case PreviousTrackResult.Previous: case PreviousTrackResult.Previous:
onScreenDisplay?.Display(new MusicActionToast("Previous track", action)); onScreenDisplay?.Display(new MusicActionToast("Previous track", e.Action));
break; break;
} }
}); });
@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Music
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -178,12 +178,12 @@ namespace osu.Game.Overlays.Toolbar
this.FadeOut(transition_time, Easing.InQuint); this.FadeOut(transition_time, Easing.InQuint);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (OverlayActivationMode.Value == OverlayActivation.Disabled) if (OverlayActivationMode.Value == OverlayActivation.Disabled)
return false; return false;
switch (action) switch (e.Action)
{ {
case GlobalAction.ToggleToolbar: case GlobalAction.ToggleToolbar:
hiddenByUser = State.Value == Visibility.Visible; // set before toggling to allow the operation to always succeed. hiddenByUser = State.Value == Visibility.Visible; // set before toggling to allow the operation to always succeed.
@ -194,7 +194,7 @@ namespace osu.Game.Overlays.Toolbar
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }
} }

View File

@ -184,9 +184,9 @@ namespace osu.Game.Overlays.Toolbar
tooltipContainer.FadeOut(100); tooltipContainer.FadeOut(100);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (action == Hotkey) if (e.Action == Hotkey)
{ {
TriggerClick(); TriggerClick();
return true; return true;
@ -195,7 +195,7 @@ namespace osu.Game.Overlays.Toolbar
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -19,27 +19,27 @@ namespace osu.Game.Overlays.Volume
private ScheduledDelegate keyRepeat; private ScheduledDelegate keyRepeat;
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.DecreaseVolume: case GlobalAction.DecreaseVolume:
case GlobalAction.IncreaseVolume: case GlobalAction.IncreaseVolume:
keyRepeat?.Cancel(); keyRepeat?.Cancel();
keyRepeat = this.BeginKeyRepeat(Scheduler, () => ActionRequested?.Invoke(action), 150); keyRepeat = this.BeginKeyRepeat(Scheduler, () => ActionRequested?.Invoke(e.Action), 150);
return true; return true;
case GlobalAction.ToggleMute: case GlobalAction.ToggleMute:
case GlobalAction.NextVolumeMeter: case GlobalAction.NextVolumeMeter:
case GlobalAction.PreviousVolumeMeter: case GlobalAction.PreviousVolumeMeter:
ActionRequested?.Invoke(action); ActionRequested?.Invoke(e.Action);
return true; return true;
} }
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
keyRepeat?.Cancel(); keyRepeat?.Cancel();
} }
@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Volume
return true; return true;
} }
public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => public bool OnScroll(KeyBindingScrollEvent<GlobalAction> e) =>
ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false; ScrollActionRequested?.Invoke(e.Action, e.ScrollAmount, e.IsPrecise) ?? false;
} }
} }

View File

@ -365,12 +365,12 @@ namespace osu.Game.Overlays.Volume
{ {
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (!IsHovered) if (!IsHovered)
return false; return false;
switch (action) switch (e.Action)
{ {
case GlobalAction.SelectPrevious: case GlobalAction.SelectPrevious:
State = SelectionState.Selected; State = SelectionState.Selected;
@ -386,7 +386,7 @@ namespace osu.Game.Overlays.Volume
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }

View File

@ -70,16 +70,16 @@ namespace osu.Game.Rulesets.UI
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
public bool OnPressed(T action) public bool OnPressed(KeyBindingPressEvent<T> e)
{ {
pressedActions.Add(action); pressedActions.Add(e.Action);
recordFrame(true); recordFrame(true);
return false; return false;
} }
public void OnReleased(T action) public void OnReleased(KeyBindingReleaseEvent<T> e)
{ {
pressedActions.Remove(action); pressedActions.Remove(e.Action);
recordFrame(true); recordFrame(true);
} }

View File

@ -152,12 +152,12 @@ namespace osu.Game.Rulesets.UI
{ {
} }
public bool OnPressed(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnPressed(action, Clock.Rate >= 0)); public bool OnPressed(KeyBindingPressEvent<T> e) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnPressed(e.Action, Clock.Rate >= 0));
public void OnReleased(T action) public void OnReleased(KeyBindingReleaseEvent<T> e)
{ {
foreach (var c in Target.Children.OfType<KeyCounterAction<T>>()) foreach (var c in Target.Children.OfType<KeyCounterAction<T>>())
c.OnReleased(action, Clock.Rate >= 0); c.OnReleased(e.Action, Clock.Rate >= 0);
} }
} }

View File

@ -8,6 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Lists; using osu.Framework.Lists;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -188,12 +189,12 @@ namespace osu.Game.Rulesets.UI.Scrolling
/// <param name="amount">The amount to adjust by. Greater than 0 if the scroll speed should be increased, less than 0 if it should be decreased.</param> /// <param name="amount">The amount to adjust by. Greater than 0 if the scroll speed should be increased, less than 0 if it should be decreased.</param>
protected virtual void AdjustScrollSpeed(int amount) => this.TransformBindableTo(TimeRange, TimeRange.Value - amount * time_span_step, 200, Easing.OutQuint); protected virtual void AdjustScrollSpeed(int amount) => this.TransformBindableTo(TimeRange, TimeRange.Value - amount * time_span_step, 200, Easing.OutQuint);
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (!UserScrollSpeedAdjustment) if (!UserScrollSpeedAdjustment)
return false; return false;
switch (action) switch (e.Action)
{ {
case GlobalAction.IncreaseScrollSpeed: case GlobalAction.IncreaseScrollSpeed:
scheduleScrollSpeedAdjustment(1); scheduleScrollSpeedAdjustment(1);
@ -209,7 +210,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
private ScheduledDelegate scheduledScrollSpeedAdjustment; private ScheduledDelegate scheduledScrollSpeedAdjustment;
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
scheduledScrollSpeedAdjustment?.Cancel(); scheduledScrollSpeedAdjustment?.Cancel();
scheduledScrollSpeedAdjustment = null; scheduledScrollSpeedAdjustment = null;

View File

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

View File

@ -4,6 +4,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osuTK; 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 // 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 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: case GlobalAction.EditorNudgeLeft:
nudgeSelection(-1); nudgeSelection(-1);
@ -36,7 +37,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
return false; 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.Graphics.Containers;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Extensions; using osu.Game.Extensions;
@ -77,15 +78,15 @@ namespace osu.Game.Screens.Edit.Compose
#region Input Handling #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()); host.GetClipboard()?.SetText(formatSelectionAsString());
return false; 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(); clock.ProcessFrame();
} }
public bool OnPressed(PlatformAction action) public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{ {
switch (action) switch (e.Action)
{ {
case PlatformAction.Cut: case PlatformAction.Cut:
Cut(); Cut();
@ -379,7 +379,7 @@ namespace osu.Game.Screens.Edit
return false; return false;
} }
public void OnReleased(PlatformAction action) public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{ {
} }
@ -434,9 +434,9 @@ namespace osu.Game.Screens.Edit
return true; return true;
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
// as we don't want to display the back button, manual handling of exit action is required. // 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); return base.OnKeyDown(e);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
return goBack(); 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays; 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(); BeginConfirm();
return true; return true;
@ -29,9 +30,9 @@ namespace osu.Game.Screens.Menu
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
if (action == GlobalAction.Back) if (e.Action == GlobalAction.Back)
{ {
if (!Fired) if (!Fired)
AbortConfirm(); AbortConfirm();

View File

@ -141,29 +141,29 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
#region Key selection logic (shared with BeatmapCarousel) #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: case GlobalAction.SelectNext:
beginRepeatSelection(() => selectNext(1), action); beginRepeatSelection(() => selectNext(1), e.Action);
return true; return true;
case GlobalAction.SelectPrevious: case GlobalAction.SelectPrevious:
beginRepeatSelection(() => selectNext(-1), action); beginRepeatSelection(() => selectNext(-1), e.Action);
return true; return true;
} }
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.SelectNext: case GlobalAction.SelectNext:
case GlobalAction.SelectPrevious: case GlobalAction.SelectPrevious:
endRepeatSelection(action); endRepeatSelection(e.Action);
break; 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) if (SelectedRoom.Value != Room)
return false; return false;
switch (action) switch (e.Action)
{ {
case GlobalAction.Select: case GlobalAction.Select:
TriggerClick(); TriggerClick();
@ -147,7 +147,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
return false; 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.Allocation;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
namespace osu.Game.Screens.OnlinePlay.Match.Components namespace osu.Game.Screens.OnlinePlay.Match.Components
{ {
@ -16,12 +17,12 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
Triangles.TriangleScale = 1.5f; Triangles.TriangleScale = 1.5f;
} }
public bool OnPressed(PlatformAction action) public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{ {
if (!Enabled.Value) if (!Enabled.Value)
return false; return false;
switch (action) switch (e.Action)
{ {
case PlatformAction.DocumentNew: case PlatformAction.DocumentNew:
// might as well also handle new tab. it's a bit of an undefined flow on this screen. // 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; 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;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; 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); 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: case GlobalAction.Select:
if (IsLoading) if (IsLoading)
@ -86,7 +87,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
return false; 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); }, true);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.ToggleChatFocus: case GlobalAction.ToggleChatFocus:
if (Textbox.HasFocus) if (Textbox.HasFocus)
@ -94,7 +94,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
return false; 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); InternalButtons.Add(button);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.SelectPrevious: case GlobalAction.SelectPrevious:
InternalButtons.SelectPrevious(); InternalButtons.SelectPrevious();
@ -211,7 +211,7 @@ namespace osu.Game.Screens.Play
return false; 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); base.OnHoverLost(e);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
case GlobalAction.PauseGameplay: // in the future this behaviour will differ for replays etc. 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; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
case GlobalAction.PauseGameplay: case GlobalAction.PauseGameplay:

View File

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

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -9,17 +10,17 @@ namespace osu.Game.Screens.Play
{ {
public class HotkeyExitOverlay : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction> 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(); BeginConfirm();
return true; 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(); AbortConfirm();
} }

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -9,17 +10,17 @@ namespace osu.Game.Screens.Play
{ {
public class HotkeyRetryOverlay : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction> 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(); BeginConfirm();
return true; 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(); AbortConfirm();
} }

View File

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

View File

@ -144,9 +144,9 @@ namespace osu.Game.Screens.Play
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.SkipCutscene: case GlobalAction.SkipCutscene:
if (!button.Enabled.Value) if (!button.Enabled.Value)
@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play
return false; 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.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; 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: case GlobalAction.Select:
statisticsPanel.ToggleVisibility(); statisticsPanel.ToggleVisibility();
@ -339,7 +340,7 @@ namespace osu.Game.Screens.Ranking
return false; 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); base.OnKeyUp(e);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.SelectNext: case GlobalAction.SelectNext:
beginRepeatSelection(() => SelectNext(1, false), action); beginRepeatSelection(() => SelectNext(1, false), e.Action);
return true; return true;
case GlobalAction.SelectPrevious: case GlobalAction.SelectPrevious:
beginRepeatSelection(() => SelectNext(-1, false), action); beginRepeatSelection(() => SelectNext(-1, false), e.Action);
return true; return true;
} }
return false; return false;
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.SelectNext: case GlobalAction.SelectNext:
case GlobalAction.SelectPrevious: case GlobalAction.SelectPrevious:
endRepeatSelection(action); endRepeatSelection(e.Action);
break; break;
} }
} }

View File

@ -172,9 +172,9 @@ namespace osu.Game.Screens.Select
return base.OnClick(e); 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(); TriggerClick();
return true; return true;
@ -183,6 +183,6 @@ namespace osu.Game.Screens.Select
return false; 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.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings; 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; return false;
} }
@ -71,9 +72,9 @@ namespace osu.Game.Screens.Select
return true; 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; rewindSearch = false;
} }

View File

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

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
@ -32,9 +33,9 @@ namespace osu.Game.Skinning.Editor
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
switch (action) switch (e.Action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
if (skinEditor?.State.Value != Visibility.Visible) if (skinEditor?.State.Value != Visibility.Visible)
@ -97,7 +98,7 @@ namespace osu.Game.Skinning.Editor
} }
} }
public void OnReleased(GlobalAction action) public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{ {
} }