mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Add helper methods
This commit is contained in:
parent
88d50b6c47
commit
2424fa0802
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Animations;
|
|||||||
using osu.Framework.Graphics.OpenGL.Textures;
|
using osu.Framework.Graphics.OpenGL.Textures;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osuTK.Graphics;
|
||||||
using static osu.Game.Skinning.LegacySkinConfiguration;
|
using static osu.Game.Skinning.LegacySkinConfiguration;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
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
|
public class SkinnableTextureAnimation : TextureAnimation
|
||||||
{
|
{
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
|
Loading…
Reference in New Issue
Block a user