From b81fc675e89b6df6161e18a45f6ae392fdbd183a Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Mon, 17 Jan 2022 20:45:25 +0800 Subject: [PATCH] Include PropertyName in PerformanceDisplayAttribute --- .../Difficulty/ManiaPerformanceAttributes.cs | 4 ++-- .../Difficulty/OsuPerformanceAttributes.cs | 8 ++++---- .../Difficulty/TaikoPerformanceAttributes.cs | 4 ++-- osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs | 2 +- .../Rulesets/Difficulty/PerformanceDisplayAttribute.cs | 8 +++++++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs index 48895cd389..17c864a268 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceAttributes.cs @@ -23,8 +23,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty foreach (var attribute in base.GetAttributesForDisplay()) yield return attribute; - yield return new PerformanceDisplayAttribute("Difficulty", Difficulty); - yield return new PerformanceDisplayAttribute("Accuracy", Accuracy); + yield return new PerformanceDisplayAttribute(nameof(Difficulty), "Difficulty", Difficulty); + yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy); } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs index 0a685b7cd6..0aeaf7669f 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs @@ -29,10 +29,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty foreach (var attribute in base.GetAttributesForDisplay()) yield return attribute; - yield return new PerformanceDisplayAttribute("Aim", Aim); - yield return new PerformanceDisplayAttribute("Speed", Speed); - yield return new PerformanceDisplayAttribute("Accuracy", Accuracy); - yield return new PerformanceDisplayAttribute("Flashlight Bonus", Flashlight); + yield return new PerformanceDisplayAttribute(nameof(Aim), "Aim", Aim); + yield return new PerformanceDisplayAttribute(nameof(Speed), "Speed", Speed); + yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy); + yield return new PerformanceDisplayAttribute(nameof(Flashlight), "Flashlight Bonus", Flashlight); } } } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs index efbcdd3703..fa5c0202dd 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs @@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty foreach (var attribute in base.GetAttributesForDisplay()) yield return attribute; - yield return new PerformanceDisplayAttribute("Difficulty", Difficulty); - yield return new PerformanceDisplayAttribute("Accuracy", Accuracy); + yield return new PerformanceDisplayAttribute(nameof(Difficulty), "Difficulty", Difficulty); + yield return new PerformanceDisplayAttribute(nameof(Accuracy), "Accuracy", Accuracy); } } } diff --git a/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs b/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs index ee1868ecff..9bdb5f8f6f 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceAttributes.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Difficulty /// public virtual IEnumerable GetAttributesForDisplay() { - yield return new PerformanceDisplayAttribute("Total", Total); + yield return new PerformanceDisplayAttribute(nameof(Total), "Total", Total); } } } diff --git a/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs b/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs index 5bb505847e..e95cb03053 100644 --- a/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs +++ b/osu.Game/Rulesets/Difficulty/PerformanceDisplayAttribute.cs @@ -7,6 +7,11 @@ namespace osu.Game.Rulesets.Difficulty /// public class PerformanceDisplayAttribute { + /// + /// Name of the attribute property in . + /// + public string PropertyName { get; } + /// /// A custom display name for the attribute. /// @@ -17,8 +22,9 @@ namespace osu.Game.Rulesets.Difficulty /// public double Value { get; } - public PerformanceDisplayAttribute(string displayName, double value) + public PerformanceDisplayAttribute(string propertyName, string displayName, double value) { + PropertyName = propertyName; DisplayName = displayName; Value = value; }