mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 03:02:54 +08:00
Simplify description logic for overlay tab items
This commit is contained in:
parent
7f9ef6c23f
commit
5880b824d0
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -13,7 +12,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Localisation;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
@ -110,20 +108,7 @@ namespace osu.Game.Overlays
|
|||||||
public OverlayHeaderTabItem(T value)
|
public OverlayHeaderTabItem(T value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
if (!(Value is Enum enumValue))
|
Text.Text = value.GetLocalisableDescription().ToLower();
|
||||||
Text.Text = Value.ToString().ToLowerInvariant();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
case LocalisableString localisableString:
|
|
||||||
Text.Text = localisableString.ToLower();
|
|
||||||
break;
|
|
||||||
|
|
||||||
// If localisable == non-localisable, then we must have a basic string, so .ToLowerInvariant() is used.
|
|
||||||
Text.Text = localisableDescription.Equals(nonLocalisableDescription)
|
|
||||||
? nonLocalisableDescription.ToLowerInvariant()
|
|
||||||
: localisableDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
Text.Font = OsuFont.GetFont(size: 14);
|
Text.Font = OsuFont.GetFont(size: 14);
|
||||||
Text.Margin = new MarginPadding { Vertical = 16.5f }; // 15px padding + 1.5px line-height difference compensation
|
Text.Margin = new MarginPadding { Vertical = 16.5f }; // 15px padding + 1.5px line-height difference compensation
|
||||||
Bar.Margin = new MarginPadding { Bottom = bar_height };
|
Bar.Margin = new MarginPadding { Bottom = bar_height };
|
||||||
|
Loading…
Reference in New Issue
Block a user