mirror of
https://github.com/osukey/osukey.git
synced 2025-05-19 12:37:38 +09: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:
parent
8f84abf348
commit
a664efe12b
@ -32,6 +32,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
return new TooltipDisplayContent
|
return new TooltipDisplayContent
|
||||||
{
|
{
|
||||||
|
Name = tooltipCounterName,
|
||||||
Count = playCount.ToString("N0"),
|
Count = playCount.ToString("N0"),
|
||||||
Date = date.ToString("MMMM yyyy")
|
Date = date.ToString("MMMM yyyy")
|
||||||
};
|
};
|
||||||
@ -39,14 +40,17 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
|
|
||||||
protected class HistoryGraphTooltip : UserGraphTooltip
|
protected class HistoryGraphTooltip : UserGraphTooltip
|
||||||
{
|
{
|
||||||
|
private readonly string tooltipCounterName;
|
||||||
|
|
||||||
public HistoryGraphTooltip(string tooltipCounterName)
|
public HistoryGraphTooltip(string tooltipCounterName)
|
||||||
: base(tooltipCounterName)
|
: base(tooltipCounterName)
|
||||||
{
|
{
|
||||||
|
this.tooltipCounterName = tooltipCounterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SetContent(object content)
|
public override bool SetContent(object content)
|
||||||
{
|
{
|
||||||
if (!(content is TooltipDisplayContent info))
|
if (!(content is TooltipDisplayContent info) || info.Name != tooltipCounterName)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Counter.Text = info.Count;
|
Counter.Text = info.Count;
|
||||||
@ -57,6 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
|
|
||||||
private class TooltipDisplayContent
|
private class TooltipDisplayContent
|
||||||
{
|
{
|
||||||
|
public string Name;
|
||||||
public string Count;
|
public string Count;
|
||||||
public string Date;
|
public string Date;
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
protected abstract class UserGraphTooltip : VisibilityContainer, ITooltip
|
protected abstract class UserGraphTooltip : VisibilityContainer, ITooltip
|
||||||
{
|
{
|
||||||
|
protected new readonly OsuSpriteText Name;
|
||||||
protected readonly OsuSpriteText Counter, BottomText;
|
protected readonly OsuSpriteText Counter, BottomText;
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
|
|
||||||
@ -237,7 +238,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Spacing = new Vector2(3, 0),
|
Spacing = new Vector2(3, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
Name = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||||
Text = tooltipCounterName
|
Text = tooltipCounterName
|
||||||
|
Loading…
x
Reference in New Issue
Block a user