1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Add ability to override text in PageTabItem

This commit is contained in:
Andrei Zavatski 2019-09-12 05:03:59 +03:00
parent f9c6a8c5b7
commit c3c2efe35c

View File

@ -63,7 +63,7 @@ namespace osu.Game.Graphics.UserInterface
Margin = new MarginPadding { Top = 8, Bottom = 8 }, Margin = new MarginPadding { Top = 8, Bottom = 8 },
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Text = (value as Enum)?.GetDescription() ?? value.ToString(), Text = CreateText(),
Font = OsuFont.GetFont(size: 14) Font = OsuFont.GetFont(size: 14)
}, },
box = new Box box = new Box
@ -81,6 +81,8 @@ namespace osu.Game.Graphics.UserInterface
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true); Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
} }
protected virtual string CreateText() => (Value as Enum)?.GetDescription() ?? Value.ToString();
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (!Active.Value) if (!Active.Value)