1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 02:37:25 +08:00
osu-lazer/osu.Game/Skinning/SkinnableSpriteText.cs

43 lines
1.2 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-09-27 15:27:11 +08:00
using System;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
2018-09-27 15:27:11 +08:00
namespace osu.Game.Skinning
{
2022-11-24 13:32:20 +08:00
public partial class SkinnableSpriteText : SkinnableDrawable, IHasText
2018-09-27 15:27:11 +08:00
{
public SkinnableSpriteText(ISkinComponentLookup lookup, Func<ISkinComponentLookup, SpriteText> defaultImplementation, ConfineMode confineMode = ConfineMode.NoScaling)
: base(lookup, defaultImplementation, confineMode)
2018-09-27 15:27:11 +08:00
{
}
protected override void SkinChanged(ISkinSource skin)
2018-09-27 15:27:11 +08:00
{
base.SkinChanged(skin);
2018-09-27 15:27:11 +08:00
if (Drawable is IHasText textDrawable)
textDrawable.Text = Text;
}
private LocalisableString text;
2018-09-27 15:27:11 +08:00
public LocalisableString Text
2018-09-27 15:27:11 +08:00
{
get => text;
set
{
if (text == value)
return;
2019-02-28 12:31:40 +08:00
2018-09-27 15:27:11 +08:00
text = value;
if (Drawable is IHasText textDrawable)
textDrawable.Text = value;
}
}
}
}