1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 17:37:50 +08:00
osu-lazer/osu.Game/Graphics/Sprites/OsuSpriteText.cs

38 lines
1.5 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
namespace osu.Game.Graphics.Sprites
{
public class OsuSpriteText : SpriteText
{
public OsuSpriteText()
{
Shadow = true;
Font = OsuFont.Default;
2018-04-13 17:19:50 +08:00
}
}
public static class OsuSpriteTextTransformExtensions
{
/// <summary>
/// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
2018-04-13 17:19:50 +08:00
/// </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="SpriteText.Text">Text</see> to a new value after a duration.
2018-04-13 17:19:50 +08:00
/// </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));
}
}