1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:03:01 +08:00

Simplify RulesetInfo string presentation

This commit is contained in:
Andrei Zavatski 2020-02-18 01:17:12 +03:00
parent 410686c8b9
commit 316c6b2a94
3 changed files with 2 additions and 17 deletions

View File

@ -116,7 +116,7 @@ namespace osu.Game.Overlays.BeatmapListing
text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Regular),
Text = GetText(value)
Text = (value as Enum)?.GetDescription() ?? value.ToString()
},
new HoverClickSounds()
});
@ -130,8 +130,6 @@ namespace osu.Game.Overlays.BeatmapListing
updateState();
}
protected virtual string GetText(T value) => (value as Enum)?.GetDescription() ?? value.ToString();
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Rulesets;
namespace osu.Game.Overlays.BeatmapListing
@ -29,18 +28,6 @@ namespace osu.Game.Overlays.BeatmapListing
foreach (var r in rulesets.AvailableRulesets)
AddItem(r);
}
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RulesetTabItem(value);
private class RulesetTabItem : FilterTabItem
{
public RulesetTabItem(RulesetInfo value)
: base(value)
{
}
protected override string GetText(RulesetInfo value) => value.Name;
}
}
}
}

View File

@ -50,6 +50,6 @@ namespace osu.Game.Rulesets
}
}
public override string ToString() => $"{Name} ({ShortName}) ID: {ID}";
public override string ToString() => Name ?? $"{Name} ({ShortName}) ID: {ID}";
}
}