Add ability to override text size

This commit is contained in:
Andrei Zavatski
2020-02-16 16:38:05 +03:00
parent 54a3705bdb
commit e62fec58c1
3 changed files with 26 additions and 1 deletions

View File

@ -37,6 +37,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
new BeatmapSearchRulesetFilter(), new BeatmapSearchRulesetFilter(),
new BeatmapSearchFilter<BeatmapSearchCategory>(), new BeatmapSearchFilter<BeatmapSearchCategory>(),
new SmallBeatmapSearchFilter<BeatmapSearchCategory>()
} }
}); });
} }

View File

@ -40,6 +40,8 @@ namespace osu.Game.Overlays.BeatmapListing
protected class FilterTabItem : TabItem<T> protected class FilterTabItem : TabItem<T>
{ {
protected virtual float TextSize() => 13;
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; }
@ -53,7 +55,7 @@ namespace osu.Game.Overlays.BeatmapListing
{ {
text = new OsuSpriteText text = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular), Font = OsuFont.GetFont(size: TextSize(), weight: FontWeight.Regular),
Text = GetText(value) Text = GetText(value)
}, },
new HoverClickSounds() new HoverClickSounds()

View File

@ -0,0 +1,22 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.BeatmapListing
{
public class SmallBeatmapSearchFilter<T> : BeatmapSearchFilter<T>
{
protected override TabItem<T> CreateTabItem(T value) => new SmallTabItem(value);
protected class SmallTabItem : FilterTabItem
{
public SmallTabItem(T value)
: base(value)
{
}
protected override float TextSize() => 10;
}
}
}