mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Make UserHistoryGraph non-abstract
This commit is contained in:
@ -74,7 +74,10 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
|
||||
private class RankGraphTooltip : UserGraphTooltip
|
||||
{
|
||||
protected override string TooltipCounterName => @"Global Ranking";
|
||||
public RankGraphTooltip()
|
||||
: base(@"Global Ranking")
|
||||
{
|
||||
}
|
||||
|
||||
public override bool SetContent(object content)
|
||||
{
|
||||
|
@ -8,15 +8,22 @@ using static osu.Game.Users.User;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public abstract class UserHistoryGraph : UserGraph<DateTime, long>
|
||||
public class UserHistoryGraph : UserGraph<DateTime, long>
|
||||
{
|
||||
public UserHistoryCount[] Values
|
||||
{
|
||||
set => Data = value?.Select(v => new KeyValuePair<DateTime, long>(v.Date, v.Count)).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Text describing the value being plotted on the graph, which will be displayed as a prefix to the value in the <see cref="HistoryGraphTooltip"/>
|
||||
/// </summary>
|
||||
public string TooltipCounterName { get; set; } = @"Plays";
|
||||
|
||||
protected override float GetDataPointHeight(long playCount) => playCount;
|
||||
|
||||
protected override UserGraphTooltip GetTooltip() => new HistoryGraphTooltip(TooltipCounterName);
|
||||
|
||||
protected override object GetTooltipContent(DateTime date, long playCount)
|
||||
{
|
||||
return new TooltipDisplayContent
|
||||
@ -26,8 +33,13 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
};
|
||||
}
|
||||
|
||||
protected abstract class HistoryGraphTooltip : UserGraphTooltip
|
||||
protected class HistoryGraphTooltip : UserGraphTooltip
|
||||
{
|
||||
public HistoryGraphTooltip(string tooltipCounterName)
|
||||
: base(tooltipCounterName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool SetContent(object content)
|
||||
{
|
||||
if (!(content is TooltipDisplayContent info))
|
||||
|
@ -197,12 +197,7 @@ namespace osu.Game.Overlays.Profile
|
||||
protected readonly OsuSpriteText Counter, BottomText;
|
||||
private readonly Box background;
|
||||
|
||||
/// <summary>
|
||||
/// Text which will be shown near the <see cref="Counter"/>.
|
||||
/// </summary>
|
||||
protected abstract string TooltipCounterName { get; }
|
||||
|
||||
protected UserGraphTooltip()
|
||||
protected UserGraphTooltip(string tooltipCounterName)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
@ -225,12 +220,13 @@ namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(3, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = $"{TooltipCounterName} "
|
||||
Text = tooltipCounterName
|
||||
},
|
||||
Counter = new OsuSpriteText
|
||||
{
|
||||
|
Reference in New Issue
Block a user