From e62fec58c1846fdfb6df580f3be6d792a2e9dc40 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 16 Feb 2020 16:38:05 +0300 Subject: [PATCH] Add ability to override text size --- .../TestSceneBeatmapSearchFilter.cs | 1 + .../BeatmapListing/BeatmapSearchFilter.cs | 4 +++- .../SmallBeatmapSearchFilter.cs | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Overlays/BeatmapListing/SmallBeatmapSearchFilter.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs index a237a8a5b5..b82ad86fb8 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatmapSearchFilter.cs @@ -37,6 +37,7 @@ public TestSceneBeatmapSearchFilter() { new BeatmapSearchRulesetFilter(), new BeatmapSearchFilter(), + new SmallBeatmapSearchFilter() } }); } diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilter.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilter.cs index acae5ce117..57e8282798 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilter.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilter.cs @@ -40,6 +40,8 @@ public BeatmapSearchFilter() protected class FilterTabItem : TabItem { + protected virtual float TextSize() => 13; + [Resolved] private OverlayColourProvider colourProvider { get; set; } @@ -53,7 +55,7 @@ public FilterTabItem(T value) { text = new OsuSpriteText { - Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular), + Font = OsuFont.GetFont(size: TextSize(), weight: FontWeight.Regular), Text = GetText(value) }, new HoverClickSounds() diff --git a/osu.Game/Overlays/BeatmapListing/SmallBeatmapSearchFilter.cs b/osu.Game/Overlays/BeatmapListing/SmallBeatmapSearchFilter.cs new file mode 100644 index 0000000000..ca387f08cf --- /dev/null +++ b/osu.Game/Overlays/BeatmapListing/SmallBeatmapSearchFilter.cs @@ -0,0 +1,22 @@ +// Copyright (c) ppy Pty Ltd . 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 : BeatmapSearchFilter + { + protected override TabItem CreateTabItem(T value) => new SmallTabItem(value); + + protected class SmallTabItem : FilterTabItem + { + public SmallTabItem(T value) + : base(value) + { + } + + protected override float TextSize() => 10; + } + } +}