Skip to content

Commit

Permalink
Merge pull request #13381 from smoogipoo/improve-hit-error-judgements
Browse files Browse the repository at this point in the history
Improve hit error judgement displays
  • Loading branch information
peppy authored Jun 9, 2021
2 parents 50eb58e + 00efed2 commit b02b8ae
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
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

0 comments on commit b02b8ae

Please sign in to comment.