Rename method

This commit is contained in:
Bartłomiej Dach
2020-10-28 23:12:28 +01:00
parent f5aedc96c4
commit a8cefb0d4c
2 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Extensions;
using osu.Game.Scoring; using osu.Game.Scoring;
namespace osu.Game.Overlays.BeatmapListing namespace osu.Game.Overlays.BeatmapListing
@ -30,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapListing
{ {
} }
protected override string CreateText(ScoreRank value) protected override string LabelFor(ScoreRank value)
{ {
switch (value) switch (value)
{ {
@ -41,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapListing
return @"Silver S"; return @"Silver S";
default: default:
return base.CreateText(value); return value.GetDescription();
} }
} }
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapListing
text = new OsuSpriteText text = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular), Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular),
Text = CreateText(value) Text = LabelFor(value)
}, },
new HoverClickSounds() new HoverClickSounds()
}); });
@ -63,7 +63,10 @@ namespace osu.Game.Overlays.BeatmapListing
protected override void OnDeactivated() => updateState(); protected override void OnDeactivated() => updateState();
protected virtual string CreateText(T value) => (value as Enum)?.GetDescription() ?? value.ToString(); /// <summary>
/// Returns the label text to be used for the supplied <paramref name="value"/>.
/// </summary>
protected virtual string LabelFor(T value) => (value as Enum)?.GetDescription() ?? value.ToString();
private void updateState() private void updateState()
{ {