1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Include PropertyName in PerformanceDisplayAttribute

This commit is contained in:
Henry Lin 2022-01-17 20:45:25 +08:00
parent d014fef179
commit b81fc675e8
5 changed files with 16 additions and 10 deletions

View File

@ -23,8 +23,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty
foreach (var attribute in base.GetAttributesForDisplay()) foreach (var attribute in base.GetAttributesForDisplay())
yield return attribute; yield return attribute;
yield return new PerformanceDisplayAttribute("Difficulty", Difficulty); yield return new PerformanceDisplayAttribute(nameof(Difficulty), "Difficulty", Difficulty);
yield return new PerformanceDisplayAttribute("Accuracy", Accuracy); yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy);
} }
} }
} }

View File

@ -29,10 +29,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty
foreach (var attribute in base.GetAttributesForDisplay()) foreach (var attribute in base.GetAttributesForDisplay())
yield return attribute; yield return attribute;
yield return new PerformanceDisplayAttribute("Aim", Aim); yield return new PerformanceDisplayAttribute(nameof(Aim), "Aim", Aim);
yield return new PerformanceDisplayAttribute("Speed", Speed); yield return new PerformanceDisplayAttribute(nameof(Speed), "Speed", Speed);
yield return new PerformanceDisplayAttribute("Accuracy", Accuracy); yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy);
yield return new PerformanceDisplayAttribute("Flashlight Bonus", Flashlight); yield return new PerformanceDisplayAttribute(nameof(Flashlight), "Flashlight Bonus", Flashlight);
} }
} }
} }

View File

@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
foreach (var attribute in base.GetAttributesForDisplay()) foreach (var attribute in base.GetAttributesForDisplay())
yield return attribute; yield return attribute;
yield return new PerformanceDisplayAttribute("Difficulty", Difficulty); yield return new PerformanceDisplayAttribute(nameof(Difficulty), "Difficulty", Difficulty);
yield return new PerformanceDisplayAttribute("Accuracy", Accuracy); yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy);
} }
} }
} }

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Difficulty
/// <returns></returns> /// <returns></returns>
public virtual IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay() public virtual IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay()
{ {
yield return new PerformanceDisplayAttribute("Total", Total); yield return new PerformanceDisplayAttribute(nameof(Total), "Total", Total);
} }
} }
} }

View File

@ -7,6 +7,11 @@ namespace osu.Game.Rulesets.Difficulty
/// </summary> /// </summary>
public class PerformanceDisplayAttribute public class PerformanceDisplayAttribute
{ {
/// <summary>
/// Name of the attribute property in <see cref="PerformanceAttributes"/>.
/// </summary>
public string PropertyName { get; }
/// <summary> /// <summary>
/// A custom display name for the attribute. /// A custom display name for the attribute.
/// </summary> /// </summary>
@ -17,8 +22,9 @@ namespace osu.Game.Rulesets.Difficulty
/// </summary> /// </summary>
public double Value { get; } public double Value { get; }
public PerformanceDisplayAttribute(string displayName, double value) public PerformanceDisplayAttribute(string propertyName, string displayName, double value)
{ {
PropertyName = propertyName;
DisplayName = displayName; DisplayName = displayName;
Value = value; Value = value;
} }