mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Store search parameters as tuple
This commit is contained in:
parent
0366a8e348
commit
524aa9162d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user