mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +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;
|
||||
|
||||
Add(graph = new UserHistoryGraph
|
||||
Add(graph = new UserHistoryGraph("Test")
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 200,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TooltipCounterName = "Test"
|
||||
});
|
||||
|
||||
var values = new[]
|
||||
|
@ -15,6 +15,11 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
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)
|
||||
: base(user, headerText)
|
||||
{
|
||||
@ -30,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
Left = 20,
|
||||
Right = 40
|
||||
},
|
||||
Child = chart = new ProfileLineChart()
|
||||
Child = chart = new ProfileLineChart(GraphCounterName)
|
||||
};
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public class PlayHistorySubsection : ChartProfileSubsection
|
||||
{
|
||||
protected override string GraphCounterName => "Plays";
|
||||
|
||||
public PlayHistorySubsection(Bindable<User> user)
|
||||
: base(user, "Play History")
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
private readonly Container<TickLine> rowLinesContainer;
|
||||
private readonly Container<TickLine> columnLinesContainer;
|
||||
|
||||
public ProfileLineChart()
|
||||
public ProfileLineChart(string graphCounterName)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 250;
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
}
|
||||
}
|
||||
},
|
||||
graph = new UserHistoryGraph
|
||||
graph = new UserHistoryGraph(graphCounterName)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public class ReplaysSubsection : ChartProfileSubsection
|
||||
{
|
||||
protected override string GraphCounterName => "Replays Watched";
|
||||
|
||||
public ReplaysSubsection(Bindable<User> user)
|
||||
: base(user, "Replays Watched History")
|
||||
{
|
||||
|
@ -11,20 +11,22 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public class UserHistoryGraph : UserGraph<DateTime, long>
|
||||
{
|
||||
private readonly string tooltipCounterName;
|
||||
|
||||
[CanBeNull]
|
||||
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";
|
||||
public UserHistoryGraph(string tooltipCounterName)
|
||||
{
|
||||
this.tooltipCounterName = tooltipCounterName;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user