Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide unexpected hit results from appearing on the hit error meter #13381

Merged
merged 2 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,34 @@ public void TestEmpty()
meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() == 2));
}

[Test]
public void TestBonus()
{
AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1));

AddStep("small bonus", () => newJudgement(result: HitResult.SmallBonus));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());

AddStep("large bonus", () => newJudgement(result: HitResult.LargeBonus));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
}

[Test]
public void TestIgnore()
{
AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1));

AddStep("ignore hit", () => newJudgement(result: HitResult.IgnoreHit));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());

AddStep("ignore miss", () => newJudgement(result: HitResult.IgnoreMiss));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
}

private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)
{
hitWindows?.SetDifficulty(overallDifficulty);
Expand Down
3 changes: 3 additions & 0 deletions osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ protected override void OnNewJudgement(JudgementResult judgement)
if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0)
return;

if (!judgement.Type.IsScorable() || judgement.Type.IsBonus())
return;

if (judgementsContainer.Count > max_concurrent_judgements)
{
const double quick_fade_time = 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osuTK;
using osuTK.Graphics;

Expand All @@ -24,7 +25,13 @@ public ColourHitErrorMeter()
InternalChild = judgementsFlow = new JudgementFlow();
}

protected override void OnNewJudgement(JudgementResult judgement) => judgementsFlow.Push(GetColourForHitResult(judgement.Type));
protected override void OnNewJudgement(JudgementResult judgement)
{
if (!judgement.Type.IsScorable() || judgement.Type.IsBonus())
return;

judgementsFlow.Push(GetColourForHitResult(judgement.Type));
}

private class JudgementFlow : FillFlowContainer<HitErrorCircle>
{
Expand Down
4 changes: 4 additions & 0 deletions osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ protected Color4 GetColourForHitResult(HitResult result)
{
switch (result)
{
case HitResult.SmallTickMiss:
case HitResult.LargeTickMiss:
case HitResult.Miss:
return colours.Red;

Expand All @@ -53,6 +55,8 @@ protected Color4 GetColourForHitResult(HitResult result)
case HitResult.Good:
return colours.GreenLight;

case HitResult.SmallTickHit:
case HitResult.LargeTickHit:
case HitResult.Great:
return colours.Blue;

Expand Down