Add helper methods

This commit is contained in:
smoogipoo 2020-08-22 00:15:58 +09:00
parent 88d50b6c47
commit 2424fa0802

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osuTK.Graphics;
using static osu.Game.Skinning.LegacySkinConfiguration;
namespace osu.Game.Skinning
@ -62,6 +63,21 @@ namespace osu.Game.Skinning
}
}
public static Color4 ToLegacyColour(this Color4 colour)
{
if (colour.A == 0)
colour.A = 1;
return colour;
}
public static T WithInitialColour<T>(this T drawable, Color4 colour)
where T : Drawable
{
drawable.Alpha = colour.A;
drawable.Colour = ToLegacyColour(colour);
return drawable;
}
public class SkinnableTextureAnimation : TextureAnimation
{
[Resolved(canBeNull: true)]