1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 13:47:33 +08:00

Move matches string inside text box

This commit is contained in:
Dean Herbert 2023-03-16 16:34:31 +09:00
parent 89b42ddd98
commit cd102da3af
2 changed files with 33 additions and 21 deletions

View File

@ -38,8 +38,8 @@ namespace osu.Game.Screens.Select
public LocalisableString InformationalText public LocalisableString InformationalText
{ {
get => filterText.Text; get => searchTextBox.FilterText.Text;
set => filterText.Text = value; set => searchTextBox.FilterText.Text = value;
} }
private OsuTabControl<SortMode> sortTabs; private OsuTabControl<SortMode> sortTabs;
@ -48,12 +48,10 @@ namespace osu.Game.Screens.Select
private Bindable<GroupMode> groupMode; private Bindable<GroupMode> groupMode;
private SeekLimitedSearchTextBox searchTextBox; private FilterControlTextBox searchTextBox;
private CollectionDropdown collectionDropdown; private CollectionDropdown collectionDropdown;
private OsuSpriteText filterText;
public FilterCriteria CreateCriteria() public FilterCriteria CreateCriteria()
{ {
string query = searchTextBox.Text; string query = searchTextBox.Text;
@ -111,22 +109,9 @@ namespace osu.Game.Screens.Select
Spacing = new Vector2(0, 5), Spacing = new Vector2(0, 5),
Children = new Drawable[] Children = new Drawable[]
{ {
searchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, searchTextBox = new FilterControlTextBox
new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
AutoSizeDuration = 200,
AutoSizeEasing = Easing.OutQuint,
Children = new Drawable[]
{
filterText = new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.Default.With(size: 12),
},
}
}, },
new Box new Box
{ {
@ -262,5 +247,32 @@ namespace osu.Game.Screens.Select
protected override bool OnClick(ClickEvent e) => true; protected override bool OnClick(ClickEvent e) => true;
protected override bool OnHover(HoverEvent e) => true; protected override bool OnHover(HoverEvent e) => true;
private partial class FilterControlTextBox : SeekLimitedSearchTextBox
{
private const float filter_text_size = 12;
public OsuSpriteText FilterText;
public FilterControlTextBox()
{
Height += filter_text_size;
TextContainer.Margin = new MarginPadding { Bottom = filter_text_size };
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
TextContainer.Add(FilterText = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.TopLeft,
Depth = float.MinValue,
Font = OsuFont.Default.With(size: filter_text_size, weight: FontWeight.SemiBold),
Margin = new MarginPadding { Top = 2, Left = 2 },
Colour = colours.Yellow
});
}
}
} }
} }

View File

@ -168,8 +168,8 @@ namespace osu.Game.Screens.Select
Carousel.CountDisplayed == 1 Carousel.CountDisplayed == 1
// Intentionally not localised until we have proper support for this (see https://github.com/ppy/osu-framework/pull/4918 // Intentionally not localised until we have proper support for this (see https://github.com/ppy/osu-framework/pull/4918
// but also in this case we want support for formatting a number within a string). // but also in this case we want support for formatting a number within a string).
? $"{Carousel.CountDisplayed:#,0} beatmap displayed" ? $"{Carousel.CountDisplayed:#,0} matching beatmap"
: $"{Carousel.CountDisplayed:#,0} beatmaps displayed"; : $"{Carousel.CountDisplayed:#,0} matching beatmaps";
}, },
GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s), GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
}, c => carouselContainer.Child = c); }, c => carouselContainer.Child = c);