1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 13:23:22 +08:00

Adjust at parse time instead

This commit is contained in:
smoogipoo 2020-06-25 14:15:26 +09:00
parent 8b84aa454d
commit 4ff9a91012
2 changed files with 7 additions and 10 deletions

View File

@ -103,7 +103,12 @@ namespace osu.Game.Beatmaps.Formats
try try
{ {
colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : (byte)255); byte alpha = split.Length == 4 ? byte.Parse(split[3]) : (byte)255;
if (alpha == 0)
alpha = 255;
colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), alpha);
} }
catch catch
{ {

View File

@ -271,15 +271,7 @@ namespace osu.Game.Skinning
} }
private IBindable<Color4> getCustomColour(IHasCustomColours source, string lookup) private IBindable<Color4> getCustomColour(IHasCustomColours source, string lookup)
{ => source.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null;
if (!source.CustomColours.TryGetValue(lookup, out var col))
return null;
if (col.A <= 0 || col.A >= 1)
col.A = 1;
return new Bindable<Color4>(col);
}
private IBindable<string> getManiaImage(LegacyManiaSkinConfiguration source, string lookup) private IBindable<string> getManiaImage(LegacyManiaSkinConfiguration source, string lookup)
=> source.ImageLookups.TryGetValue(lookup, out var image) ? new Bindable<string>(image) : null; => source.ImageLookups.TryGetValue(lookup, out var image) ? new Bindable<string>(image) : null;