1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Rename ClicksPerSecondCalculator to ClicksPerSecondController

This commit is contained in:
Dean Herbert 2023-06-27 16:38:46 +09:00
parent de23a4691e
commit 8bd6f7a46a
7 changed files with 20 additions and 20 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
public partial class TestSceneClicksPerSecondCalculator : OsuTestScene
{
private ClicksPerSecondCalculator calculator = null!;
private ClicksPerSecondController controller = null!;
private TestGameplayClock manualGameplayClock = null!;
@ -34,11 +34,11 @@ namespace osu.Game.Tests.Visual.Gameplay
CachedDependencies = new (Type, object)[] { (typeof(IGameplayClock), manualGameplayClock) },
Children = new Drawable[]
{
calculator = new ClicksPerSecondCalculator(),
controller = new ClicksPerSecondController(),
new DependencyProvidingContainer
{
RelativeSizeAxes = Axes.Both,
CachedDependencies = new (Type, object)[] { (typeof(ClicksPerSecondCalculator), calculator) },
CachedDependencies = new (Type, object)[] { (typeof(ClicksPerSecondController), controller) },
Child = new ClicksPerSecondCounter
{
Anchor = Anchor.Centre,
@ -81,7 +81,7 @@ namespace osu.Game.Tests.Visual.Gameplay
checkClicksPerSecondValue(6);
}
private void checkClicksPerSecondValue(int i) => AddAssert("clicks/s is correct", () => calculator.Value, () => Is.EqualTo(i));
private void checkClicksPerSecondValue(int i) => AddAssert("clicks/s is correct", () => controller.Value, () => Is.EqualTo(i));
private void seekClockImmediately(double time) => manualGameplayClock.CurrentTime = time;
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Gameplay
foreach (double timestamp in inputs)
{
seekClockImmediately(timestamp);
calculator.AddInputTimestamp();
controller.AddInputTimestamp();
}
seekClockImmediately(baseTime);

View File

@ -338,8 +338,8 @@ namespace osu.Game.Rulesets.UI
public void Attach(InputCountController inputCountController) =>
(KeyBindingInputManager as ICanAttachHUDPieces)?.Attach(inputCountController);
public void Attach(ClicksPerSecondCalculator calculator) =>
(KeyBindingInputManager as ICanAttachHUDPieces)?.Attach(calculator);
public void Attach(ClicksPerSecondController controller) =>
(KeyBindingInputManager as ICanAttachHUDPieces)?.Attach(controller);
/// <summary>
/// Creates a key conversion input manager. An exception will be thrown if a valid <see cref="RulesetInputManager{T}"/> is not returned.

View File

@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.UI
public interface ICanAttachHUDPieces
{
void Attach(InputCountController inputCountController);
void Attach(ClicksPerSecondCalculator calculator);
void Attach(ClicksPerSecondController controller);
}
}

View File

@ -177,20 +177,20 @@ namespace osu.Game.Rulesets.UI
#region Keys per second Counter Attachment
public void Attach(ClicksPerSecondCalculator calculator) => KeyBindingContainer.Add(new ActionListener(calculator));
public void Attach(ClicksPerSecondController controller) => KeyBindingContainer.Add(new ActionListener(controller));
private partial class ActionListener : Component, IKeyBindingHandler<T>
{
private readonly ClicksPerSecondCalculator calculator;
private readonly ClicksPerSecondController controller;
public ActionListener(ClicksPerSecondCalculator calculator)
public ActionListener(ClicksPerSecondController controller)
{
this.calculator = calculator;
this.controller = controller;
}
public bool OnPressed(KeyBindingPressEvent<T> e)
{
calculator.AddInputTimestamp();
controller.AddInputTimestamp();
return false;
}

View File

@ -8,7 +8,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
{
public partial class ClicksPerSecondCalculator : Component
public partial class ClicksPerSecondController : Component
{
private readonly List<double> timestamps = new List<double>();
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
private IGameplayClock clock => frameStableClock ?? gameplayClock;
public ClicksPerSecondCalculator()
public ClicksPerSecondController()
{
RelativeSizeAxes = Axes.Both;
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
public partial class ClicksPerSecondCounter : RollingCounter<int>, ISerialisableDrawable
{
[Resolved]
private ClicksPerSecondCalculator calculator { get; set; } = null!;
private ClicksPerSecondController controller { get; set; } = null!;
protected override double RollingDuration => 350;
@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play.HUD.ClicksPerSecond
{
base.Update();
Current.Value = calculator.Value;
Current.Value = controller.Value;
}
protected override IHasText CreateText() => new TextComponent();

View File

@ -59,7 +59,7 @@ namespace osu.Game.Screens.Play
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
[Cached]
private readonly ClicksPerSecondCalculator clicksPerSecondCalculator;
private readonly ClicksPerSecondController clicksPerSecondController;
[Cached]
public readonly InputCountController InputCountController;
@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play
CreateFailingLayer(),
//Needs to be initialized before skinnable drawables.
judgementCountController = new JudgementCountController(),
clicksPerSecondCalculator = new ClicksPerSecondCalculator(),
clicksPerSecondController = new ClicksPerSecondController(),
InputCountController = new InputCountController(),
mainComponents = new HUDComponentsContainer { AlwaysPresent = true, },
rulesetComponents = drawableRuleset != null
@ -322,7 +322,7 @@ namespace osu.Game.Screens.Play
if (drawableRuleset is ICanAttachHUDPieces attachTarget)
{
attachTarget.Attach(InputCountController);
attachTarget.Attach(clicksPerSecondCalculator);
attachTarget.Attach(clicksPerSecondController);
}
replayLoaded.BindTo(drawableRuleset.HasReplayLoaded);