1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 23:27:25 +08:00

Store search parameters as tuple

This commit is contained in:
Dean Herbert 2023-02-01 19:38:47 +09:00
parent 0366a8e348
commit 524aa9162d

View File

@ -17,20 +17,21 @@ namespace osu.Game.Overlays.BeatmapListing
{
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>(Overlays.SortDirection.Descending);
private SearchCategory? lastCategory;
private bool? lastHasQuery;
private (SearchCategory category, bool hasQuery)? currentParameters;
protected override void LoadComplete()
{
base.LoadComplete();
if (lastCategory == null && lastHasQuery == null)
if (currentParameters == null)
Reset(SearchCategory.Leaderboard, false);
}
public void Reset(SearchCategory category, bool hasQuery)
{
if (category != lastCategory || hasQuery != lastHasQuery)
var newParameters = (category, hasQuery);
if (currentParameters != newParameters)
{
TabControl.Clear();
@ -65,8 +66,7 @@ namespace osu.Game.Overlays.BeatmapListing
// see: https://github.com/ppy/osu-framework/issues/5412
TabControl.Current.TriggerChange();
lastCategory = category;
lastHasQuery = hasQuery;
currentParameters = newParameters;
}
protected override SortTabControl CreateControl() => new BeatmapSortTabControl