mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:05:34 +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,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow),
|
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
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.Green,
|
Colour = colours.Green,
|
||||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (HitWindows.Meh * 2))
|
Height = (float)((HitWindows.Good - HitWindows.Great) / (getMehHitWindows() * 2))
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.BlueLight,
|
Colour = colours.BlueLight,
|
||||||
Height = (float)(HitWindows.Great / HitWindows.Meh)
|
Height = (float)(HitWindows.Great / getMehHitWindows())
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.Green,
|
Colour = colours.Green,
|
||||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (HitWindows.Meh * 2))
|
Height = (float)((HitWindows.Good - HitWindows.Great) / (getMehHitWindows() * 2))
|
||||||
},
|
},
|
||||||
new Box
|
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)((HitWindows.Meh - HitWindows.Good) / (HitWindows.Meh * 2))
|
Height = (float)((getMehHitWindows() - HitWindows.Good) / (getMehHitWindows() * 2))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
type.BindValueChanged(onTypeChanged, true);
|
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)
|
private void onTypeChanged(ValueChangedEvent<ScoreMeterType> type)
|
||||||
{
|
{
|
||||||
switch (type.NewValue)
|
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)
|
private float calculateArrowPosition(JudgementResult newJudgement)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user