mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Invert if to reduce nesting
This commit is contained in:
parent
719da48922
commit
ca68d94cf7
@ -226,25 +226,25 @@ namespace osu.Game.Tournament.Screens
|
|||||||
|
|
||||||
base.Action = () =>
|
base.Action = () =>
|
||||||
{
|
{
|
||||||
if (numberBox.Text.Length > 0)
|
if (string.IsNullOrEmpty(numberBox.Text))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// box contains text
|
||||||
|
if (!int.TryParse(numberBox.Text, out var number))
|
||||||
{
|
{
|
||||||
// box contains text
|
// at this point, the only reason we can arrive here is if the input number was too big to parse into an int
|
||||||
if (!int.TryParse(numberBox.Text, out var number))
|
// so clamp to max allowed value
|
||||||
{
|
number = height_max_allowed_value;
|
||||||
// at this point, the only reason we can arrive here is if the input number was too big to parse into an int
|
|
||||||
// so clamp to max allowed value
|
|
||||||
number = height_max_allowed_value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
number = Math.Clamp(number, height_min_allowed_value, height_max_allowed_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// in case number got clamped, reset number in numberBox
|
|
||||||
numberBox.Text = number.ToString();
|
|
||||||
|
|
||||||
Action?.Invoke(number);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
number = Math.Clamp(number, height_min_allowed_value, height_max_allowed_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// in case number got clamped, reset number in numberBox
|
||||||
|
numberBox.Text = number.ToString();
|
||||||
|
|
||||||
|
Action?.Invoke(number);
|
||||||
};
|
};
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user