mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:03:11 +08:00
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.
This commit is contained in:
parent
ddd6c1a1c6
commit
c61fac578c
@ -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<OsuAction> e)
|
||||
{
|
||||
if (e.Action == Action)
|
||||
Unlight();
|
||||
Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<bool>? OnLightUp;
|
||||
public event Action<bool>? OnUnlight;
|
||||
public event Action<bool>? OnActivate;
|
||||
public event Action<bool>? 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!EqualityComparer<T>.Default.Equals(action, Action))
|
||||
return false;
|
||||
|
||||
LightUp(forwards);
|
||||
Activate(forwards);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!EqualityComparer<T>.Default.Equals(action, Action))
|
||||
return;
|
||||
|
||||
Unlight(forwards);
|
||||
Deactivate(forwards);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user