mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 01:33:12 +08:00
Simplify RulesetInfo string presentation
This commit is contained in:
parent
410686c8b9
commit
316c6b2a94
@ -116,7 +116,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Regular),
|
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Regular),
|
||||||
Text = GetText(value)
|
Text = (value as Enum)?.GetDescription() ?? value.ToString()
|
||||||
},
|
},
|
||||||
new HoverClickSounds()
|
new HoverClickSounds()
|
||||||
});
|
});
|
||||||
@ -130,8 +130,6 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string GetText(T value) => (value as Enum)?.GetDescription() ?? value.ToString();
|
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
base.OnHover(e);
|
base.OnHover(e);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
@ -29,18 +28,6 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
foreach (var r in rulesets.AvailableRulesets)
|
foreach (var r in rulesets.AvailableRulesets)
|
||||||
AddItem(r);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user