mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Add text transforms to OsuSpriteText
This commit is contained in:
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics.Transforms;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Sprites
|
namespace osu.Game.Graphics.Sprites
|
||||||
{
|
{
|
||||||
@ -40,4 +41,23 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
return base.CreateFallbackCharacterDrawable();
|
return base.CreateFallbackCharacterDrawable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class OsuSpriteTextTransformExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Sets <see cref="OsuSpriteText.Text"/> to a new value after a duration.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
|
||||||
|
public static TransformSequence<T> TransformTextTo<T>(this T spriteText, string newText, double duration = 0, Easing easing = Easing.None)
|
||||||
|
where T : OsuSpriteText
|
||||||
|
=> spriteText.TransformTo(nameof(OsuSpriteText.Text), newText, duration, easing);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets <see cref="OsuSpriteText.Text"/> to a new value after a duration.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
|
||||||
|
public static TransformSequence<T> TransformTextTo<T>(this TransformSequence<T> t, string newText, double duration = 0, Easing easing = Easing.None)
|
||||||
|
where T : OsuSpriteText
|
||||||
|
=> t.Append(o => o.TransformTextTo(newText, duration, easing));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user