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

Don't present Meh hit windows if it has no value

This commit is contained in:
Andrei Zavatski 2019-08-19 22:45:27 +03:00
parent f1c3a60660
commit 50c47568e4
2 changed files with 49 additions and 24 deletions

View File

@ -14,6 +14,8 @@ using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Tests.Visual.Gameplay namespace osu.Game.Tests.Visual.Gameplay
{ {
@ -95,7 +97,24 @@ namespace osu.Game.Tests.Visual.Gameplay
private void recreateDisplay(HitWindows hitWindows, float overallDifficulty) private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)
{ {
hitWindows.SetDifficulty(overallDifficulty);
Clear(); Clear();
Add(new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
Children = new[]
{
new SpriteText { Text = $@"Great: {hitWindows.Great}" },
new SpriteText { Text = $@"Good: {hitWindows.Good}" },
new SpriteText { Text = $@"Meh: {hitWindows.Meh}" },
}
});
Add(display = new DefaultHitErrorDisplay(overallDifficulty, hitWindows) Add(display = new DefaultHitErrorDisplay(overallDifficulty, hitWindows)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -32,12 +32,14 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
private readonly FillFlowContainer bar; private readonly FillFlowContainer bar;
private readonly Container judgementsContainer; private readonly Container judgementsContainer;
private readonly Queue<double> judgementOffsets = new Queue<double>(); private readonly Queue<double> judgementOffsets = new Queue<double>();
private readonly double maxHitWindows;
public DefaultHitErrorDisplay(float overallDifficulty, HitWindows hitWindows, bool reversed = false) public DefaultHitErrorDisplay(float overallDifficulty, HitWindows hitWindows, bool reversed = false)
: base(overallDifficulty, hitWindows) : base(overallDifficulty, hitWindows)
{ {
AutoSizeAxes = Axes.Both; maxHitWindows = HitWindows.Meh == 0 ? HitWindows.Good : HitWindows.Meh;
AutoSizeAxes = Axes.Both;
AddInternal(new FillFlowContainer AddInternal(new FillFlowContainer
{ {
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
@ -83,48 +85,52 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
bar.AddRange(new Drawable[] Box topGreenBox;
{ Box bottomGreenBox;
new Box
if (HitWindows.Meh != 0)
bar.Add(new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow), Colour = ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow),
Height = (float)((getMehHitWindows() - HitWindows.Good) / (getMehHitWindows() * 2)) Height = (float)((maxHitWindows - HitWindows.Good) / (maxHitWindows * 2))
}, });
new Box
bar.AddRange(new Drawable[]
{
topGreenBox = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.Green, Colour = colours.Green,
Height = (float)((HitWindows.Good - HitWindows.Great) / (getMehHitWindows() * 2)) Height = (float)((HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2))
}, },
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.BlueLight, Colour = colours.BlueLight,
Height = (float)(HitWindows.Great / getMehHitWindows()) Height = (float)(HitWindows.Great / maxHitWindows)
}, },
new Box bottomGreenBox = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.Green, Colour = colours.Green,
Height = (float)((HitWindows.Good - HitWindows.Great) / (getMehHitWindows() * 2)) Height = (float)((HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2))
}, }
new Box });;
if (HitWindows.Meh != 0)
bar.Add(new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientVertical(colours.Yellow, colours.Yellow.Opacity(0)), Colour = ColourInfo.GradientVertical(colours.Yellow, colours.Yellow.Opacity(0)),
Height = (float)((getMehHitWindows() - HitWindows.Good) / (getMehHitWindows() * 2)) Height = (float)((maxHitWindows - HitWindows.Good) / (maxHitWindows * 2))
} });
});
}
private double getMehHitWindows()
{
// In case if ruleset has no Meh hit windows (like Taiko)
if (HitWindows.Meh == 0) if (HitWindows.Meh == 0)
return HitWindows.Good + 40; {
topGreenBox.Colour = ColourInfo.GradientVertical(colours.Green.Opacity(0), colours.Green);
return HitWindows.Meh; bottomGreenBox.Colour = ColourInfo.GradientVertical(colours.Green, colours.Green.Opacity(0));
}
} }
public override void OnNewJudgement(JudgementResult newJudgement) public override void OnNewJudgement(JudgementResult newJudgement)
@ -157,7 +163,7 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
} }
}; };
private float getRelativeJudgementPosition(double value) => (float)(value / getMehHitWindows()); private float getRelativeJudgementPosition(double value) => (float)(value / maxHitWindows);
private float calculateArrowPosition(JudgementResult newJudgement) private float calculateArrowPosition(JudgementResult newJudgement)
{ {