From c61fac578ca53fa4dba22ac7ec85aa0cc335c762 Mon Sep 17 00:00:00 2001 From: tsrk Date: Thu, 16 Feb 2023 23:15:03 +0000 Subject: [PATCH] style(KeyCounter): rename methods and arguments As for the second suggestion in https://github.com/ppy/osu/pull/22654#discussion_r1109047998, I went with the first one as only one Trigger actually uses this argument for rewinding. --- .../TestSceneOsuTouchInput.cs | 4 ++-- osu.Game/Screens/Play/KeyCounter.cs | 20 +++++++++---------- .../Screens/Play/KeyCounterActionTrigger.cs | 4 ++-- .../Screens/Play/KeyCounterKeyboardTrigger.cs | 4 ++-- .../Screens/Play/KeyCounterMouseTrigger.cs | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuTouchInput.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuTouchInput.cs index c73025ebb9..8a933c6b24 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuTouchInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuTouchInput.cs @@ -593,7 +593,7 @@ namespace osu.Game.Rulesets.Osu.Tests { if (e.Action == Action) { - LightUp(); + Activate(); } return false; @@ -602,7 +602,7 @@ namespace osu.Game.Rulesets.Osu.Tests public void OnReleased(KeyBindingReleaseEvent e) { if (e.Action == Action) - Unlight(); + Deactivate(); } } diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 23afa97597..a276c9d59e 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -36,8 +36,8 @@ namespace osu.Game.Screens.Play Trigger = trigger, }; - Trigger.OnLightUp += LightUp; - Trigger.OnUnlight += Unlight; + Trigger.OnActivate += Activate; + Trigger.OnDeactivate += Deactivate; Name = trigger.Name; } @@ -60,14 +60,14 @@ namespace osu.Game.Screens.Play countPresses.Value--; } - protected virtual void LightUp(bool increment = true) + protected virtual void Activate(bool increment = true) { IsLit.Value = true; if (increment) Increment(); } - protected virtual void Unlight(bool preserve = true) + protected virtual void Deactivate(bool preserve = true) { IsLit.Value = false; if (!preserve) @@ -77,23 +77,23 @@ namespace osu.Game.Screens.Play protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - Trigger.OnLightUp -= LightUp; - Trigger.OnUnlight -= Unlight; + Trigger.OnActivate -= Activate; + Trigger.OnDeactivate -= Deactivate; } public abstract partial class InputTrigger : Component { - public event Action? OnLightUp; - public event Action? OnUnlight; + public event Action? OnActivate; + public event Action? OnDeactivate; protected InputTrigger(string name) { Name = name; } - protected void LightUp(bool increment = true) => OnLightUp?.Invoke(increment); + protected void Activate(bool forwardPlayback = true) => OnActivate?.Invoke(forwardPlayback); - protected void Unlight(bool preserve = true) => OnUnlight?.Invoke(preserve); + protected void Deactivate(bool forwardPlayback = true) => OnDeactivate?.Invoke(forwardPlayback); } } } diff --git a/osu.Game/Screens/Play/KeyCounterActionTrigger.cs b/osu.Game/Screens/Play/KeyCounterActionTrigger.cs index c6acb3f95f..8bb9bdc886 100644 --- a/osu.Game/Screens/Play/KeyCounterActionTrigger.cs +++ b/osu.Game/Screens/Play/KeyCounterActionTrigger.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play if (!EqualityComparer.Default.Equals(action, Action)) return false; - LightUp(forwards); + Activate(forwards); return false; } @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Play if (!EqualityComparer.Default.Equals(action, Action)) return; - Unlight(forwards); + Deactivate(forwards); } } } diff --git a/osu.Game/Screens/Play/KeyCounterKeyboardTrigger.cs b/osu.Game/Screens/Play/KeyCounterKeyboardTrigger.cs index 18eb6b7612..56c5ab0083 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboardTrigger.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboardTrigger.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play { if (e.Key == Key) { - LightUp(); + Activate(); } return base.OnKeyDown(e); @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Play protected override void OnKeyUp(KeyUpEvent e) { if (e.Key == Key) - Unlight(); + Deactivate(); base.OnKeyUp(e); } diff --git a/osu.Game/Screens/Play/KeyCounterMouseTrigger.cs b/osu.Game/Screens/Play/KeyCounterMouseTrigger.cs index 1446494b5b..66890073a8 100644 --- a/osu.Game/Screens/Play/KeyCounterMouseTrigger.cs +++ b/osu.Game/Screens/Play/KeyCounterMouseTrigger.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseDown(MouseDownEvent e) { if (e.Button == Button) - LightUp(); + Activate(); return base.OnMouseDown(e); } @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Play protected override void OnMouseUp(MouseUpEvent e) { if (e.Button == Button) - Unlight(); + Deactivate(); base.OnMouseUp(e); }