1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Rename {KeyCounter -> InputCount}Controller

This commit is contained in:
Bartłomiej Dach 2023-06-26 19:27:42 +02:00
parent 4ac48e4cd8
commit 8d91580dc1
No known key found for this signature in database
15 changed files with 28 additions and 28 deletions

View File

@ -35,14 +35,14 @@ namespace osu.Game.Tests.Visual.Gameplay
var referenceBeatmap = CreateBeatmap(new OsuRuleset().RulesetInfo);
AddUntilStep("score above zero", () => Player.ScoreProcessor.TotalScore.Value > 0);
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Triggers.Any(kc => kc.ActivationCount.Value > 2));
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.InputCountController.Triggers.Any(kc => kc.ActivationCount.Value > 2));
seekTo(referenceBeatmap.Breaks[0].StartTime);
AddAssert("keys not counting", () => !Player.HUDOverlay.KeyCounter.IsCounting.Value);
AddAssert("keys not counting", () => !Player.HUDOverlay.InputCountController.IsCounting.Value);
AddAssert("overlay displays 100% accuracy", () => Player.BreakOverlay.ChildrenOfType<BreakInfo>().Single().AccuracyDisplay.Current.Value == 1);
AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000));
AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Triggers.All(kc => kc.ActivationCount.Value == 0));
AddUntilStep("key counter reset", () => Player.HUDOverlay.InputCountController.Triggers.All(kc => kc.ActivationCount.Value == 0));
seekTo(referenceBeatmap.HitObjects[^1].GetEndTime());
AddUntilStep("results displayed", () => getResultsScreen()?.IsLoaded == true);

View File

@ -79,7 +79,7 @@ namespace osu.Game.Tests.Visual.Gameplay
(typeof(HealthProcessor), actualComponentsContainer.Dependencies.Get<HealthProcessor>()),
(typeof(GameplayState), actualComponentsContainer.Dependencies.Get<GameplayState>()),
(typeof(IGameplayClock), actualComponentsContainer.Dependencies.Get<IGameplayClock>()),
(typeof(KeyCounterController), actualComponentsContainer.Dependencies.Get<KeyCounterController>())
(typeof(InputCountController), actualComponentsContainer.Dependencies.Get<InputCountController>())
},
};

View File

@ -31,11 +31,11 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
addSeekStep(3000);
AddAssert("all judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged));
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Triggers.Select(kc => kc.ActivationCount.Value).Sum() == 15);
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.InputCountController.Triggers.Select(kc => kc.ActivationCount.Value).Sum() == 15);
AddStep("clear results", () => Player.Results.Clear());
addSeekStep(0);
AddAssert("none judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => !h.Judged));
AddUntilStep("key counters reset", () => Player.HUDOverlay.KeyCounter.Triggers.All(kc => kc.ActivationCount.Value == 0));
AddUntilStep("key counters reset", () => Player.HUDOverlay.InputCountController.Triggers.All(kc => kc.ActivationCount.Value == 0));
AddAssert("no results triggered", () => Player.Results.Count == 0);
}

View File

@ -269,7 +269,7 @@ namespace osu.Game.Tests.Visual.Gameplay
hudOverlay = new HUDOverlay(null, Array.Empty<Mod>());
// Add any key just to display the key counter visually.
hudOverlay.KeyCounter.Add(new KeyCounterKeyboardTrigger(Key.Space));
hudOverlay.InputCountController.Add(new KeyCounterKeyboardTrigger(Key.Space));
scoreProcessor.Combo.Value = 1;

View File

@ -18,13 +18,13 @@ namespace osu.Game.Tests.Visual.Gameplay
public partial class TestSceneKeyCounter : OsuManualInputManagerTestScene
{
[Cached]
private readonly KeyCounterController controller;
private readonly InputCountController controller;
public TestSceneKeyCounter()
{
Children = new Drawable[]
{
controller = new KeyCounterController(),
controller = new InputCountController(),
new FillFlowContainer
{
Anchor = Anchor.Centre,

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
protected override void AddCheckSteps()
{
AddUntilStep("score above zero", () => ((ScoreAccessibleReplayPlayer)Player).ScoreProcessor.TotalScore.Value > 0);
AddUntilStep("key counter counted keys", () => ((ScoreAccessibleReplayPlayer)Player).HUDOverlay.KeyCounter.Triggers.Any(kc => kc.ActivationCount.Value > 0));
AddUntilStep("key counter counted keys", () => ((ScoreAccessibleReplayPlayer)Player).HUDOverlay.InputCountController.Triggers.Any(kc => kc.ActivationCount.Value > 0));
AddAssert("cannot fail", () => !((ScoreAccessibleReplayPlayer)Player).AllowFail);
}

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Gameplay
};
// Add any key just to display the key counter visually.
hudOverlay.KeyCounter.Add(new KeyCounterKeyboardTrigger(Key.Space));
hudOverlay.InputCountController.Add(new KeyCounterKeyboardTrigger(Key.Space));
scoreProcessor.Combo.Value = 1;
return new Container

View File

@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Gameplay
hudOverlay = new HUDOverlay(null, Array.Empty<Mod>());
// Add any key just to display the key counter visually.
hudOverlay.KeyCounter.Add(new KeyCounterKeyboardTrigger(Key.Space));
hudOverlay.InputCountController.Add(new KeyCounterKeyboardTrigger(Key.Space));
action?.Invoke(hudOverlay);

View File

@ -335,8 +335,8 @@ namespace osu.Game.Rulesets.UI
/// <returns>The representing <see cref="DrawableHitObject{TObject}"/>.</returns>
public abstract DrawableHitObject<TObject> CreateDrawableRepresentation(TObject h);
public void Attach(KeyCounterController keyCounter) =>
(KeyBindingInputManager as ICanAttachHUDPieces)?.Attach(keyCounter);
public void Attach(InputCountController inputCountController) =>
(KeyBindingInputManager as ICanAttachHUDPieces)?.Attach(inputCountController);
public void Attach(ClicksPerSecondCalculator calculator) =>
(KeyBindingInputManager as ICanAttachHUDPieces)?.Attach(calculator);

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.UI
/// </remarks>
public interface ICanAttachHUDPieces
{
void Attach(KeyCounterController keyCounter);
void Attach(InputCountController inputCountController);
void Attach(ClicksPerSecondCalculator calculator);
}
}

View File

@ -160,11 +160,11 @@ namespace osu.Game.Rulesets.UI
#region Key Counter Attachment
public void Attach(KeyCounterController keyCounter)
public void Attach(InputCountController inputCountController)
{
KeyBindingContainer.Add(keyCounter);
KeyBindingContainer.Add(inputCountController);
keyCounter.AddRange(KeyBindingContainer.DefaultKeyBindings
inputCountController.AddRange(KeyBindingContainer.DefaultKeyBindings
.Select(b => b.GetAction<T>())
.Distinct()
.OrderBy(action => action)

View File

@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play.HUD
/// Keeps track of key press counts for a current play session, exposing bindable counts which can
/// be used for display purposes.
/// </summary>
public partial class KeyCounterController : CompositeComponent
public partial class InputCountController : CompositeComponent
{
public readonly Bindable<bool> IsCounting = new BindableBool(true);
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.HUD
public IReadOnlyList<InputTrigger> Triggers => triggers;
public KeyCounterController()
public InputCountController()
{
InternalChild = triggers = new Container<InputTrigger>();
}

View File

@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play.HUD
protected readonly Bindable<bool> ConfigVisibility = new Bindable<bool>();
[Resolved]
private KeyCounterController controller { get; set; } = null!;
private InputCountController controller { get; set; } = null!;
protected abstract void UpdateVisibility();

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens.Play
private readonly ClicksPerSecondCalculator clicksPerSecondCalculator;
[Cached]
public readonly KeyCounterController KeyCounter;
public readonly InputCountController InputCountController;
[Cached]
private readonly JudgementTally tally;
@ -112,7 +112,7 @@ namespace osu.Game.Screens.Play
RelativeSizeAxes = Axes.Both;
// intentionally not added to hierarchy here as it will be attached via `BindDrawableRuleset()`.
KeyCounter = new KeyCounterController();
InputCountController = new InputCountController();
Children = new[]
{
@ -307,13 +307,13 @@ namespace osu.Game.Screens.Play
{
PlayerSettingsOverlay.Show();
ModDisplay.FadeIn(200);
KeyCounter.Margin = new MarginPadding(10) { Bottom = 30 };
InputCountController.Margin = new MarginPadding(10) { Bottom = 30 };
}
else
{
PlayerSettingsOverlay.Hide();
ModDisplay.Delay(2000).FadeOut(200);
KeyCounter.Margin = new MarginPadding(10);
InputCountController.Margin = new MarginPadding(10);
}
updateVisibility();
@ -323,7 +323,7 @@ namespace osu.Game.Screens.Play
{
if (drawableRuleset is ICanAttachHUDPieces attachTarget)
{
attachTarget.Attach(KeyCounter);
attachTarget.Attach(InputCountController);
attachTarget.Attach(clicksPerSecondCalculator);
}

View File

@ -432,7 +432,7 @@ namespace osu.Game.Screens.Play
IsPaused = { BindTarget = GameplayClockContainer.IsPaused },
ReplayLoaded = { BindTarget = DrawableRuleset.HasReplayLoaded },
},
KeyCounter =
InputCountController =
{
IsCounting =
{
@ -477,7 +477,7 @@ namespace osu.Game.Screens.Play
{
updateGameplayState();
updatePauseOnFocusLostState();
HUDOverlay.KeyCounter.IsCounting.Value = !isBreakTime.NewValue;
HUDOverlay.InputCountController.IsCounting.Value = !isBreakTime.NewValue;
}
private void updateGameplayState()