1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 22:33:05 +08:00

Add ContentTooltipText to ProfileValueDisplay

This commit is contained in:
Joseph Madamba 2024-02-09 15:17:34 -08:00
parent c9c39ecb2f
commit 8d1d65a469

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -13,7 +14,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
public partial class ProfileValueDisplay : CompositeDrawable public partial class ProfileValueDisplay : CompositeDrawable
{ {
private readonly OsuSpriteText title; private readonly OsuSpriteText title;
private readonly OsuSpriteText content; private readonly ContentText content;
public LocalisableString Title public LocalisableString Title
{ {
@ -25,6 +26,11 @@ namespace osu.Game.Overlays.Profile.Header.Components
set => content.Text = value; set => content.Text = value;
} }
public LocalisableString ContentTooltipText
{
set => content.TooltipText = value;
}
public ProfileValueDisplay(bool big = false, int minimumWidth = 60) public ProfileValueDisplay(bool big = false, int minimumWidth = 60)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
@ -38,9 +44,9 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
Font = OsuFont.GetFont(size: 12) Font = OsuFont.GetFont(size: 12)
}, },
content = new OsuSpriteText content = new ContentText
{ {
Font = OsuFont.GetFont(size: big ? 30 : 20, weight: FontWeight.Light) Font = OsuFont.GetFont(size: big ? 30 : 20, weight: FontWeight.Light),
}, },
new Container // Add a minimum size to the FillFlowContainer new Container // Add a minimum size to the FillFlowContainer
{ {
@ -56,5 +62,10 @@ namespace osu.Game.Overlays.Profile.Header.Components
title.Colour = colourProvider.Content1; title.Colour = colourProvider.Content1;
content.Colour = colourProvider.Content2; content.Colour = colourProvider.Content2;
} }
private partial class ContentText : OsuSpriteText, IHasTooltip
{
public LocalisableString TooltipText { get; set; }
}
} }
} }