1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:25:05 +08:00

Fix beatmap details source and tags not filtering on song select

This commit is contained in:
Salman Ahmed 2022-07-15 06:41:49 +03:00
parent eafa11555a
commit 97c3eea3aa
2 changed files with 23 additions and 13 deletions

View File

@ -40,6 +40,9 @@ namespace osu.Game.Screens.Select
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
[Resolved(canBeNull: true)]
private SongSelect songSelect { get; set; }
private IBeatmapInfo beatmapInfo; private IBeatmapInfo beatmapInfo;
private APIFailTimes failTimes; private APIFailTimes failTimes;
@ -140,9 +143,9 @@ namespace osu.Game.Screens.Select
LayoutEasing = Easing.OutQuad, LayoutEasing = Easing.OutQuad,
Children = new[] Children = new[]
{ {
description = new MetadataSection(MetadataType.Description), description = new MetadataSection(MetadataType.Description, searchOnSongSelect),
source = new MetadataSection(MetadataType.Source), source = new MetadataSection(MetadataType.Source, searchOnSongSelect),
tags = new MetadataSection(MetadataType.Tags), tags = new MetadataSection(MetadataType.Tags, searchOnSongSelect),
}, },
}, },
}, },
@ -175,6 +178,12 @@ namespace osu.Game.Screens.Select
}, },
loading = new LoadingLayer(true) loading = new LoadingLayer(true)
}; };
void searchOnSongSelect(string text)
{
if (songSelect != null)
songSelect.FilterControl.SearchTextBox.Text = text;
}
} }
private void updateStatistics() private void updateStatistics()

View File

@ -39,7 +39,7 @@ namespace osu.Game.Screens.Select
public FilterCriteria CreateCriteria() public FilterCriteria CreateCriteria()
{ {
string query = searchTextBox.Text; string query = SearchTextBox.Text;
var criteria = new FilterCriteria var criteria = new FilterCriteria
{ {
@ -62,7 +62,8 @@ namespace osu.Game.Screens.Select
return criteria; return criteria;
} }
private SeekLimitedSearchTextBox searchTextBox; public SeekLimitedSearchTextBox SearchTextBox { get; private set; }
private CollectionFilterDropdown collectionDropdown; private CollectionFilterDropdown collectionDropdown;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
@ -103,7 +104,7 @@ namespace osu.Game.Screens.Select
Height = 60, Height = 60,
Children = new Drawable[] Children = new Drawable[]
{ {
searchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X }, SearchTextBox = new SeekLimitedSearchTextBox { RelativeSizeAxes = Axes.X },
new Box new Box
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -204,23 +205,23 @@ namespace osu.Game.Screens.Select
updateCriteria(); updateCriteria();
}; };
searchTextBox.Current.ValueChanged += _ => updateCriteria(); SearchTextBox.Current.ValueChanged += _ => updateCriteria();
updateCriteria(); updateCriteria();
} }
public void Deactivate() public void Deactivate()
{ {
searchTextBox.ReadOnly = true; SearchTextBox.ReadOnly = true;
searchTextBox.HoldFocus = false; SearchTextBox.HoldFocus = false;
if (searchTextBox.HasFocus) if (SearchTextBox.HasFocus)
GetContainingInputManager().ChangeFocus(searchTextBox); GetContainingInputManager().ChangeFocus(SearchTextBox);
} }
public void Activate() public void Activate()
{ {
searchTextBox.ReadOnly = false; SearchTextBox.ReadOnly = false;
searchTextBox.HoldFocus = true; SearchTextBox.HoldFocus = true;
} }
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>(); private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();