1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 22:02:56 +08:00

Apply OnRelease method signature refactorings

This commit is contained in:
smoogipoo 2020-01-22 13:22:34 +09:00
parent fc331e7752
commit 7b2f58eb30
38 changed files with 108 additions and 74 deletions

View File

@ -36,7 +36,10 @@ namespace osu.Game.Rulesets.Catch.Mods
//disable keyboard controls
public bool OnPressed(CatchAction action) => true;
public bool OnReleased(CatchAction action) => true;
public void OnReleased(CatchAction action)
{
}
protected override bool OnMouseMove(MouseMoveEvent e)
{

View File

@ -103,7 +103,9 @@ namespace osu.Game.Rulesets.Catch.UI
MovableCatcher.X = state.CatcherX.Value;
}
public bool OnReleased(CatchAction action) => false;
public void OnReleased(CatchAction action)
{
}
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
@ -341,24 +343,22 @@ namespace osu.Game.Rulesets.Catch.UI
return false;
}
public bool OnReleased(CatchAction action)
public void OnReleased(CatchAction action)
{
switch (action)
{
case CatchAction.MoveLeft:
currentDirection++;
return true;
break;
case CatchAction.MoveRight:
currentDirection--;
return true;
break;
case CatchAction.Dash:
Dashing = false;
return true;
break;
}
return false;
}
/// <summary>

View File

@ -171,17 +171,17 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
bodyPiece.Hitting = true;
}
public bool OnReleased(ManiaAction action)
public void OnReleased(ManiaAction action)
{
if (AllJudged)
return false;
return;
if (action != Action.Value)
return false;
return;
// Make sure a hold was started
if (HoldStartTime == null)
return false;
return;
Tail.UpdateResult();
endHold();
@ -189,8 +189,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
// If the key has been released too early, the user should not receive full score for the release
if (!Tail.IsHit)
HasBroken = true;
return true;
}
private void endHold()

View File

@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
public override bool OnReleased(ManiaAction action) => false; // Handled by the hold note
public override void OnReleased(ManiaAction action)
{
}
}
}

View File

@ -59,6 +59,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
public override bool OnReleased(ManiaAction action) => false; // Handled by the hold note
public override void OnReleased(ManiaAction action)
{
}
}
}

View File

@ -77,6 +77,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
return UpdateResult(true);
}
public virtual bool OnReleased(ManiaAction action) => false;
public virtual void OnReleased(ManiaAction action)
{
}
}
}

View File

@ -191,7 +191,9 @@ namespace osu.Game.Rulesets.Mania.UI
return true;
}
public bool OnReleased(ManiaAction action) => false;
public void OnReleased(ManiaAction action)
{
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border

View File

@ -98,11 +98,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
return false;
}
public bool OnReleased(ManiaAction action)
public void OnReleased(ManiaAction action)
{
if (action == this.action.Value)
backgroundOverlay.FadeTo(0, 250, Easing.OutQuint);
return false;
}
}
}

View File

@ -115,11 +115,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
return false;
}
public bool OnReleased(ManiaAction action)
public void OnReleased(ManiaAction action)
{
if (action == this.action.Value)
keyIcon.ScaleTo(1f, 125, Easing.OutQuint);
return false;
}
}
}

View File

@ -108,7 +108,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
return false;
}
public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
public void OnReleased(PlatformAction action)
{
}
private void selectPiece(PathControlPointPiece piece, MouseButtonEvent e)
{

View File

@ -205,7 +205,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
return false;
}
public bool OnReleased(OsuAction action) => false;
public void OnReleased(OsuAction action)
{
}
}
}
}

View File

@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
return false;
}
public bool OnReleased(OsuAction action)
public void OnReleased(OsuAction action)
{
switch (action)
{
@ -120,8 +120,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
updateExpandedState();
break;
}
return false;
}
public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.

View File

@ -107,7 +107,9 @@ namespace osu.Game.Rulesets.Osu.UI
return false;
}
public bool OnReleased(OsuAction action) => false;
public void OnReleased(OsuAction action)
{
}
public void Appear() => Schedule(() =>
{

View File

@ -77,11 +77,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
return result;
}
public override bool OnReleased(TaikoAction action)
public override void OnReleased(TaikoAction action)
{
if (action == HitAction)
HitAction = null;
return base.OnReleased(action);
base.OnReleased(action);
}
protected override void Update()

View File

@ -77,7 +77,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public Drawable CreateProxiedContent() => proxiedContent.CreateProxy();
public abstract bool OnPressed(TaikoAction action);
public virtual bool OnReleased(TaikoAction action) => false;
public virtual void OnReleased(TaikoAction action)
{
}
public override double LifetimeStart
{

View File

@ -187,7 +187,9 @@ namespace osu.Game.Rulesets.Taiko.UI
return false;
}
public bool OnReleased(TaikoAction action) => false;
public void OnReleased(TaikoAction action)
{
}
}
}
}

View File

@ -99,7 +99,9 @@ namespace osu.Game.Graphics.Containers
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
protected override void UpdateState(ValueChangedEvent<Visibility> state)
{

View File

@ -67,7 +67,9 @@ namespace osu.Game.Graphics
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
private volatile int screenShotTasks;

View File

@ -67,7 +67,9 @@ namespace osu.Game.Graphics.UserInterface
return false;
}
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
public void OnReleased(GlobalAction action)
{
}
}
}
}

View File

@ -80,7 +80,9 @@ namespace osu.Game.Graphics.UserInterface
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
public override bool RequestsFocus => HoldFocus;
}

View File

@ -50,7 +50,7 @@ namespace osu.Game.Input
public bool OnPressed(PlatformAction action) => updateLastInteractionTime();
public bool OnReleased(PlatformAction action) => updateLastInteractionTime();
public void OnReleased(PlatformAction action) => updateLastInteractionTime();
protected override bool Handle(UIEvent e)
{

View File

@ -881,7 +881,9 @@ namespace osu.Game
#endregion
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
private Container overlayContent;

View File

@ -326,7 +326,9 @@ namespace osu.Game.Overlays
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
public class MusicControllerToast : Toast
{

View File

@ -16,6 +16,9 @@ namespace osu.Game.Overlays.Volume
public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false;
public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false;
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
}
}

View File

@ -139,7 +139,11 @@ 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 OnReleased(T action) => Target.Children.OfType<KeyCounterAction<T>>().Any(c => c.OnReleased(action, Clock.Rate >= 0));
public void OnReleased(T action)
{
foreach (var c in Target.Children.OfType<KeyCounterAction<T>>())
c.OnReleased(action, Clock.Rate >= 0);
}
}
#endregion

View File

@ -201,7 +201,9 @@ namespace osu.Game.Rulesets.UI.Scrolling
throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset<TObject>)}.");
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
private class LocalScrollingInfo : IScrollingInfo
{

View File

@ -215,7 +215,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
}
public bool OnReleased(PlatformAction action) => false;
public void OnReleased(PlatformAction action)
{
}
protected override void Update()
{

View File

@ -87,7 +87,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
}
public bool OnReleased(PlatformAction action) => action.ActionMethod == PlatformActionMethod.Delete;
public void OnReleased(PlatformAction action)
{
}
#endregion

View File

@ -253,7 +253,9 @@ namespace osu.Game.Screens.Edit
return false;
}
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
public void OnReleased(GlobalAction action)
{
}
public override void OnResuming(IScreen last)
{

View File

@ -211,7 +211,9 @@ namespace osu.Game.Screens.Menu
}
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
private bool goBack()
{

View File

@ -24,16 +24,13 @@ namespace osu.Game.Screens.Menu
return false;
}
public bool OnReleased(GlobalAction action)
public void OnReleased(GlobalAction action)
{
if (action == GlobalAction.Back)
{
if (!Fired)
AbortConfirm();
return true;
}
return false;
}
}
}

View File

@ -247,16 +247,8 @@ namespace osu.Game.Screens.Play
return false;
}
public bool OnReleased(GlobalAction action)
public void OnReleased(GlobalAction action)
{
switch (action)
{
case GlobalAction.Back:
case GlobalAction.Select:
return true;
}
return false;
}
private void buttonSelectionChanged(DialogButton button, bool isSelected)

View File

@ -259,16 +259,14 @@ namespace osu.Game.Screens.Play.HUD
return false;
}
public bool OnReleased(GlobalAction action)
public void OnReleased(GlobalAction action)
{
switch (action)
{
case GlobalAction.Back:
AbortConfirm();
return true;
break;
}
return false;
}
protected override bool OnMouseDown(MouseDownEvent e)

View File

@ -17,12 +17,11 @@ namespace osu.Game.Screens.Play
return true;
}
public bool OnReleased(GlobalAction action)
public void OnReleased(GlobalAction action)
{
if (action != GlobalAction.QuickExit) return false;
if (action != GlobalAction.QuickExit) return;
AbortConfirm();
return true;
}
}
}

View File

@ -17,12 +17,11 @@ namespace osu.Game.Screens.Play
return true;
}
public bool OnReleased(GlobalAction action)
public void OnReleased(GlobalAction action)
{
if (action != GlobalAction.QuickRetry) return false;
if (action != GlobalAction.QuickRetry) return;
AbortConfirm();
return true;
}
}
}

View File

@ -27,15 +27,14 @@ namespace osu.Game.Screens.Play
return false;
}
public bool OnReleased(T action, bool forwards)
public void OnReleased(T action, bool forwards)
{
if (!EqualityComparer<T>.Default.Equals(action, Action))
return false;
return;
IsLit = false;
if (!forwards)
Decrement();
return false;
}
}
}

View File

@ -143,7 +143,9 @@ namespace osu.Game.Screens.Play
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
private class FadeContainer : Container, IStateful<Visibility>
{

View File

@ -681,7 +681,9 @@ namespace osu.Game.Screens.Select
return false;
}
public bool OnReleased(GlobalAction action) => action == GlobalAction.Select;
public void OnReleased(GlobalAction action)
{
}
protected override bool OnKeyDown(KeyDownEvent e)
{