mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 18:32:55 +08:00
Add tooltip to ScoreComponentLabel.
This commit is contained in:
parent
db4c26e1ab
commit
a7bab14b30
@ -8,6 +8,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
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.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -165,8 +166,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
Margin = new MarginPadding { Left = edge_margin },
|
Margin = new MarginPadding { Left = edge_margin },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
maxCombo = new ScoreComponentLabel(FontAwesome.fa_link, Score.MaxCombo.ToString()),
|
maxCombo = new ScoreComponentLabel(FontAwesome.fa_link, Score.MaxCombo.ToString(), "Max Combo"),
|
||||||
accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", Score.Accuracy)),
|
accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", Score.Accuracy), "Accuracy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -309,20 +310,24 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ScoreComponentLabel : Container
|
private class ScoreComponentLabel : Container, IHasTooltip
|
||||||
{
|
{
|
||||||
private const float icon_size = 20;
|
private const float icon_size = 20;
|
||||||
|
|
||||||
|
private readonly string name;
|
||||||
private readonly FillFlowContainer content;
|
private readonly FillFlowContainer content;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
public override bool Contains(Vector2 screenSpacePos) => content.Contains(screenSpacePos);
|
||||||
|
|
||||||
public ScoreComponentLabel(FontAwesome icon, string value)
|
public string TooltipText => name;
|
||||||
|
|
||||||
|
public ScoreComponentLabel(FontAwesome icon, string value, string name)
|
||||||
{
|
{
|
||||||
|
this.name = name;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
Width = 60;
|
Width = 60;
|
||||||
|
|
||||||
InternalChild = content = new FillFlowContainer
|
Child = content = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
|
Loading…
Reference in New Issue
Block a user