1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Rename all "KeysPerSecond" usages to "ClicksPerSecond"

This commit is contained in:
Ryuki 2022-08-14 20:12:11 +02:00
parent 9dc806506e
commit 2aa3a1b50d
No known key found for this signature in database
GPG Key ID: A353889EAEACBF49
6 changed files with 29 additions and 29 deletions

View File

@ -19,16 +19,16 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD.KeysPerSecond; using osu.Game.Screens.Play.HUD.ClicksPerSecond;
using osuTK; using osuTK;
namespace osu.Game.Tests.Visual.Gameplay namespace osu.Game.Tests.Visual.Gameplay
{ {
public class TestSceneKeysPerSecond : OsuTestScene public class TestSceneClicksPerSecond : OsuTestScene
{ {
private DependencyProvidingContainer? dependencyContainer; private DependencyProvidingContainer? dependencyContainer;
private MockFrameStableClock? mainClock; private MockFrameStableClock? mainClock;
private KeysPerSecondCalculator? calculator; private ClicksPerSecondCalculator? calculator;
private ManualInputListener? listener; private ManualInputListener? listener;
[SetUpSteps] [SetUpSteps]
@ -61,12 +61,12 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
dependencyContainer!.Children = new Drawable[] dependencyContainer!.Children = new Drawable[]
{ {
calculator = new KeysPerSecondCalculator(), calculator = new ClicksPerSecondCalculator(),
new DependencyProvidingContainer new DependencyProvidingContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
CachedDependencies = new (Type, object)[] { (typeof(KeysPerSecondCalculator), calculator) }, CachedDependencies = new (Type, object)[] { (typeof(ClicksPerSecondCalculator), calculator) },
Child = new KeysPerSecondCounter // For visual debugging, has no real purpose in the tests Child = new ClicksPerSecondCounter // For visual debugging, has no real purpose in the tests
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -204,11 +204,11 @@ namespace osu.Game.Tests.Visual.Gameplay
#region Mock classes #region Mock classes
private class ManualInputListener : KeysPerSecondCalculator.InputListener private class ManualInputListener : ClicksPerSecondCalculator.InputListener
{ {
public void AddInput() => Calculator.AddTimestamp(); public void AddInput() => Calculator.AddTimestamp();
public ManualInputListener(KeysPerSecondCalculator calculator) public ManualInputListener(ClicksPerSecondCalculator calculator)
: base(calculator) : base(calculator)
{ {
} }

View File

@ -30,7 +30,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD.KeysPerSecond; using osu.Game.Screens.Play.HUD.ClicksPerSecond;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
@ -341,7 +341,7 @@ namespace osu.Game.Rulesets.UI
public void Attach(KeyCounterDisplay keyCounter) => public void Attach(KeyCounterDisplay keyCounter) =>
(KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter); (KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter);
public void Attach(KeysPerSecondCalculator calculator) => (KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(calculator); public void Attach(ClicksPerSecondCalculator calculator) => (KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(calculator);
/// <summary> /// <summary>
/// Creates a key conversion input manager. An exception will be thrown if a valid <see cref="RulesetInputManager{T}"/> is not returned. /// Creates a key conversion input manager. An exception will be thrown if a valid <see cref="RulesetInputManager{T}"/> is not returned.

View File

@ -20,7 +20,7 @@ using osu.Game.Input.Bindings;
using osu.Game.Input.Handlers; using osu.Game.Input.Handlers;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD.KeysPerSecond; using osu.Game.Screens.Play.HUD.ClicksPerSecond;
using static osu.Game.Input.Handlers.ReplayInputHandler; using static osu.Game.Input.Handlers.ReplayInputHandler;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
@ -189,7 +189,7 @@ namespace osu.Game.Rulesets.UI
#region Keys per second Counter Attachment #region Keys per second Counter Attachment
public void Attach(KeysPerSecondCalculator calculator) public void Attach(ClicksPerSecondCalculator calculator)
{ {
if (calculator == null) return; if (calculator == null) return;
@ -200,7 +200,7 @@ namespace osu.Game.Rulesets.UI
calculator.Listener = listener; calculator.Listener = listener;
} }
public class ActionListener : KeysPerSecondCalculator.InputListener, IKeyBindingHandler<T> public class ActionListener : ClicksPerSecondCalculator.InputListener, IKeyBindingHandler<T>
{ {
public bool OnPressed(KeyBindingPressEvent<T> e) public bool OnPressed(KeyBindingPressEvent<T> e)
{ {
@ -213,7 +213,7 @@ namespace osu.Game.Rulesets.UI
{ {
} }
public ActionListener(KeysPerSecondCalculator calculator) public ActionListener(ClicksPerSecondCalculator calculator)
: base(calculator) : base(calculator)
{ {
} }
@ -262,7 +262,7 @@ namespace osu.Game.Rulesets.UI
public interface ICanAttachKeyCounter public interface ICanAttachKeyCounter
{ {
void Attach(KeyCounterDisplay keyCounter); void Attach(KeyCounterDisplay keyCounter);
void Attach(KeysPerSecondCalculator calculator); void Attach(ClicksPerSecondCalculator calculator);
} }
public class RulesetInputManagerInputState<T> : InputState public class RulesetInputManagerInputState<T> : InputState

View File

@ -9,9 +9,9 @@ using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
namespace osu.Game.Screens.Play.HUD.KeysPerSecond namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
{ {
public class KeysPerSecondCalculator : Component public class ClicksPerSecondCalculator : Component
{ {
private readonly List<double> timestamps; private readonly List<double> timestamps;
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD.KeysPerSecond
public bool Ready => workingClock != null && gameplayClock != null && listener != null; public bool Ready => workingClock != null && gameplayClock != null && listener != null;
public int Value => timestamps.Count(isTimestampWithinSpan); public int Value => timestamps.Count(isTimestampWithinSpan);
public KeysPerSecondCalculator() public ClicksPerSecondCalculator()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
timestamps = new List<double>(); timestamps = new List<double>();
@ -91,9 +91,9 @@ namespace osu.Game.Screens.Play.HUD.KeysPerSecond
public abstract class InputListener : Component public abstract class InputListener : Component
{ {
protected KeysPerSecondCalculator Calculator; protected ClicksPerSecondCalculator Calculator;
protected InputListener(KeysPerSecondCalculator calculator) protected InputListener(ClicksPerSecondCalculator calculator)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Depth = float.MinValue; Depth = float.MinValue;

View File

@ -13,27 +13,27 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
namespace osu.Game.Screens.Play.HUD.KeysPerSecond namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
{ {
public class KeysPerSecondCounter : RollingCounter<int>, ISkinnableDrawable public class ClicksPerSecondCounter : RollingCounter<int>, ISkinnableDrawable
{ {
private const float alpha_when_invalid = 0.3f; private const float alpha_when_invalid = 0.3f;
private readonly Bindable<bool> valid = new Bindable<bool>(); private readonly Bindable<bool> valid = new Bindable<bool>();
private KeysPerSecondCalculator? calculator; private ClicksPerSecondCalculator? calculator;
protected override double RollingDuration => 350; protected override double RollingDuration => 350;
public bool UsesFixedAnchor { get; set; } public bool UsesFixedAnchor { get; set; }
public KeysPerSecondCounter() public ClicksPerSecondCounter()
{ {
Current.Value = 0; Current.Value = 0;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, KeysPerSecondCalculator calculator) private void load(OsuColour colours, ClicksPerSecondCalculator calculator)
{ {
this.calculator = calculator; this.calculator = calculator;
Colour = colours.BlueLighter; Colour = colours.BlueLighter;

View File

@ -22,7 +22,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.HUD.KeysPerSecond; using osu.Game.Screens.Play.HUD.ClicksPerSecond;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play
public readonly PlayerSettingsOverlay PlayerSettingsOverlay; public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
[Cached] [Cached]
private readonly KeysPerSecondCalculator keysPerSecondCalculator; private readonly ClicksPerSecondCalculator clicksPerSecondCalculator;
public Bindable<bool> ShowHealthBar = new Bindable<bool>(true); public Bindable<bool> ShowHealthBar = new Bindable<bool>(true);
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play
HoldToQuit = CreateHoldForMenuButton(), HoldToQuit = CreateHoldForMenuButton(),
} }
}, },
keysPerSecondCalculator = new KeysPerSecondCalculator() clicksPerSecondCalculator = new ClicksPerSecondCalculator()
}; };
} }
@ -265,7 +265,7 @@ namespace osu.Game.Screens.Play
protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset) protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset)
{ {
(drawableRuleset as ICanAttachKeyCounter)?.Attach(KeyCounter); (drawableRuleset as ICanAttachKeyCounter)?.Attach(KeyCounter);
(drawableRuleset as ICanAttachKeyCounter)?.Attach(keysPerSecondCalculator); (drawableRuleset as ICanAttachKeyCounter)?.Attach(clicksPerSecondCalculator);
replayLoaded.BindTo(drawableRuleset.HasReplayLoaded); replayLoaded.BindTo(drawableRuleset.HasReplayLoaded);
} }