mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 23:47:24 +08:00
Fix crash if ruleset has no Meh hit windows
This commit is contained in:
parent
55cd1cecdf
commit
6c60db550f
@ -107,37 +107,46 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow),
|
||||
Height = (float)((HitWindows.Meh - HitWindows.Good) / (HitWindows.Meh * 2))
|
||||
Height = (float)((getMehHitWindows() - HitWindows.Good) / (getMehHitWindows() * 2))
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Green,
|
||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (HitWindows.Meh * 2))
|
||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (getMehHitWindows() * 2))
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.BlueLight,
|
||||
Height = (float)(HitWindows.Great / HitWindows.Meh)
|
||||
Height = (float)(HitWindows.Great / getMehHitWindows())
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Green,
|
||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (HitWindows.Meh * 2))
|
||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (getMehHitWindows() * 2))
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(colours.Yellow, colours.Yellow.Opacity(0)),
|
||||
Height = (float)((HitWindows.Meh - HitWindows.Good) / (HitWindows.Meh * 2))
|
||||
Height = (float)((getMehHitWindows() - HitWindows.Good) / (getMehHitWindows() * 2))
|
||||
}
|
||||
});
|
||||
|
||||
type.BindValueChanged(onTypeChanged, true);
|
||||
}
|
||||
|
||||
private double getMehHitWindows()
|
||||
{
|
||||
// In case if ruleset has no Meh hit windows (like Taiko)
|
||||
if (HitWindows.Meh == 0)
|
||||
return HitWindows.Good + 40;
|
||||
|
||||
return HitWindows.Meh;
|
||||
}
|
||||
|
||||
private void onTypeChanged(ValueChangedEvent<ScoreMeterType> type)
|
||||
{
|
||||
switch (type.NewValue)
|
||||
@ -183,7 +192,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
}
|
||||
};
|
||||
|
||||
private float getRelativeJudgementPosition(double value) => (float)(value / HitWindows.Meh);
|
||||
private float getRelativeJudgementPosition(double value) => (float)(value / getMehHitWindows());
|
||||
|
||||
private float calculateArrowPosition(JudgementResult newJudgement)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user