mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Display performance breakdown in a tooltip
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty
|
||||
@ -12,5 +13,14 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
/// </summary>
|
||||
[JsonProperty("pp")]
|
||||
public double Total { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return a <see cref="PerformanceDisplayAttribute"/> for each attribute so that a performance breakdown can be displayed.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay()
|
||||
{
|
||||
yield return new PerformanceDisplayAttribute("Total", Total);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs
Normal file
26
osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
/// <summary>
|
||||
/// Data for displaying a performance attribute to user. Includes a display name for clarity.
|
||||
/// </summary>
|
||||
public class PerformanceDisplayAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// A custom display name for the attribute.
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The associated attribute value.
|
||||
/// </summary>
|
||||
public double Value { get; }
|
||||
|
||||
public PerformanceDisplayAttribute(string displayName, double value)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user