mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 09:43:10 +08:00
Display "replays watched" tooltip for replays subsection
This commit is contained in:
parent
84e1ff79a0
commit
8f84abf348
@ -19,13 +19,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
UserHistoryGraph graph;
|
UserHistoryGraph graph;
|
||||||
|
|
||||||
Add(graph = new UserHistoryGraph
|
Add(graph = new UserHistoryGraph("Test")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 200,
|
Height = 200,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
TooltipCounterName = "Test"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var values = new[]
|
var values = new[]
|
||||||
|
@ -15,6 +15,11 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
private ProfileLineChart chart;
|
private ProfileLineChart chart;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text describing the value being plotted on the graph, which will be displayed as a prefix to the value in the history graph tooltip.
|
||||||
|
/// </summary>
|
||||||
|
protected abstract string GraphCounterName { get; }
|
||||||
|
|
||||||
protected ChartProfileSubsection(Bindable<User> user, string headerText)
|
protected ChartProfileSubsection(Bindable<User> user, string headerText)
|
||||||
: base(user, headerText)
|
: base(user, headerText)
|
||||||
{
|
{
|
||||||
@ -30,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
Left = 20,
|
Left = 20,
|
||||||
Right = 40
|
Right = 40
|
||||||
},
|
},
|
||||||
Child = chart = new ProfileLineChart()
|
Child = chart = new ProfileLineChart(GraphCounterName)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
public class PlayHistorySubsection : ChartProfileSubsection
|
public class PlayHistorySubsection : ChartProfileSubsection
|
||||||
{
|
{
|
||||||
|
protected override string GraphCounterName => "Plays";
|
||||||
|
|
||||||
public PlayHistorySubsection(Bindable<User> user)
|
public PlayHistorySubsection(Bindable<User> user)
|
||||||
: base(user, "Play History")
|
: base(user, "Play History")
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
private readonly Container<TickLine> rowLinesContainer;
|
private readonly Container<TickLine> rowLinesContainer;
|
||||||
private readonly Container<TickLine> columnLinesContainer;
|
private readonly Container<TickLine> columnLinesContainer;
|
||||||
|
|
||||||
public ProfileLineChart()
|
public ProfileLineChart(string graphCounterName)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 250;
|
Height = 250;
|
||||||
@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
graph = new UserHistoryGraph
|
graph = new UserHistoryGraph(graphCounterName)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
public class ReplaysSubsection : ChartProfileSubsection
|
public class ReplaysSubsection : ChartProfileSubsection
|
||||||
{
|
{
|
||||||
|
protected override string GraphCounterName => "Replays Watched";
|
||||||
|
|
||||||
public ReplaysSubsection(Bindable<User> user)
|
public ReplaysSubsection(Bindable<User> user)
|
||||||
: base(user, "Replays Watched History")
|
: base(user, "Replays Watched History")
|
||||||
{
|
{
|
||||||
|
@ -11,20 +11,22 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
public class UserHistoryGraph : UserGraph<DateTime, long>
|
public class UserHistoryGraph : UserGraph<DateTime, long>
|
||||||
{
|
{
|
||||||
|
private readonly string tooltipCounterName;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public UserHistoryCount[] Values
|
public UserHistoryCount[] Values
|
||||||
{
|
{
|
||||||
set => Data = value?.Select(v => new KeyValuePair<DateTime, long>(v.Date, v.Count)).ToArray();
|
set => Data = value?.Select(v => new KeyValuePair<DateTime, long>(v.Date, v.Count)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public UserHistoryGraph(string tooltipCounterName)
|
||||||
/// 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>
|
this.tooltipCounterName = tooltipCounterName;
|
||||||
public string TooltipCounterName { get; set; } = "Plays";
|
}
|
||||||
|
|
||||||
protected override float GetDataPointHeight(long playCount) => playCount;
|
protected override float GetDataPointHeight(long playCount) => playCount;
|
||||||
|
|
||||||
protected override UserGraphTooltip GetTooltip() => new HistoryGraphTooltip(TooltipCounterName);
|
protected override UserGraphTooltip GetTooltip() => new HistoryGraphTooltip(tooltipCounterName);
|
||||||
|
|
||||||
protected override object GetTooltipContent(DateTime date, long playCount)
|
protected override object GetTooltipContent(DateTime date, long playCount)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user