mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 04:47:39 +09:00
Remove ugly if-statement
This commit is contained in:
parent
cb1703c6e2
commit
40c17cfa5a
@ -88,16 +88,17 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (split.Length != 3 && split.Length != 4)
|
if (split.Length != 3 && split.Length != 4)
|
||||||
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}");
|
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}");
|
||||||
|
|
||||||
byte a = 255;
|
Color4 colour;
|
||||||
|
|
||||||
if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)
|
try
|
||||||
|| split.Length == 4 && !byte.TryParse(split[3], out a))
|
{
|
||||||
|
colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : 255);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(@"Color must be specified with 8-bit integer components");
|
throw new InvalidOperationException(@"Color must be specified with 8-bit integer components");
|
||||||
}
|
}
|
||||||
|
|
||||||
Color4 colour = new Color4(r, g, b, a);
|
|
||||||
|
|
||||||
if (isCombo)
|
if (isCombo)
|
||||||
{
|
{
|
||||||
if (!(output is IHasComboColours tHasComboColours)) return;
|
if (!(output is IHasComboColours tHasComboColours)) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user