1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

Fix history graph tooltips leaking to others

Since there was no check about which tooltip content came from which graph, all history graphs use the "Replays Watched" tooltip, as it is the latest created one.
This commit is contained in:
Salman Ahmed 2021-04-13 07:59:13 +03:00
parent 8f84abf348
commit a664efe12b
2 changed files with 8 additions and 2 deletions

View File

@ -32,6 +32,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
return new TooltipDisplayContent
{
Name = tooltipCounterName,
Count = playCount.ToString("N0"),
Date = date.ToString("MMMM yyyy")
};
@ -39,14 +40,17 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
protected class HistoryGraphTooltip : UserGraphTooltip
{
private readonly string tooltipCounterName;
public HistoryGraphTooltip(string tooltipCounterName)
: base(tooltipCounterName)
{
this.tooltipCounterName = tooltipCounterName;
}
public override bool SetContent(object content)
{
if (!(content is TooltipDisplayContent info))
if (!(content is TooltipDisplayContent info) || info.Name != tooltipCounterName)
return false;
Counter.Text = info.Count;
@ -57,6 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
private class TooltipDisplayContent
{
public string Name;
public string Count;
public string Date;
}

View File

@ -208,6 +208,7 @@ namespace osu.Game.Overlays.Profile
protected abstract class UserGraphTooltip : VisibilityContainer, ITooltip
{
protected new readonly OsuSpriteText Name;
protected readonly OsuSpriteText Counter, BottomText;
private readonly Box background;
@ -237,7 +238,7 @@ namespace osu.Game.Overlays.Profile
Spacing = new Vector2(3, 0),
Children = new Drawable[]
{
new OsuSpriteText
Name = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Text = tooltipCounterName