// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Framework.Graphics.Sprites; namespace osu.Game.Skinning { public class SkinnableSpriteText : SkinnableDrawable, IHasText { public SkinnableSpriteText(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true) : base(name, defaultImplementation, allowFallback, restrictSize) { } protected override void SkinChanged(ISkinSource skin, bool allowFallback) { base.SkinChanged(skin, allowFallback); if (Drawable is IHasText textDrawable) textDrawable.Text = Text; } private string text; public string Text { get => text; set { if (text == value) return; text = value; if (Drawable is IHasText textDrawable) textDrawable.Text = value; } } } }