mirror of
https://github.com/ppy/osu
synced 2025-01-23 06:13:12 +00:00
Add text transforms to OsuSpriteText
This commit is contained in:
parent
7fa3ac8cf2
commit
edd0d166b1
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Graphics.Sprites
|
||||
{
|
||||
@ -40,4 +41,23 @@ namespace osu.Game.Graphics.Sprites
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user