mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 02:07:34 +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);
|
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>(Overlays.SortDirection.Descending);
|
||||||
|
|
||||||
private SearchCategory? lastCategory;
|
private (SearchCategory category, bool hasQuery)? currentParameters;
|
||||||
private bool? lastHasQuery;
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (lastCategory == null && lastHasQuery == null)
|
if (currentParameters == null)
|
||||||
Reset(SearchCategory.Leaderboard, false);
|
Reset(SearchCategory.Leaderboard, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset(SearchCategory category, bool hasQuery)
|
public void Reset(SearchCategory category, bool hasQuery)
|
||||||
{
|
{
|
||||||
if (category != lastCategory || hasQuery != lastHasQuery)
|
var newParameters = (category, hasQuery);
|
||||||
|
|
||||||
|
if (currentParameters != newParameters)
|
||||||
{
|
{
|
||||||
TabControl.Clear();
|
TabControl.Clear();
|
||||||
|
|
||||||
@ -65,8 +66,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
// see: https://github.com/ppy/osu-framework/issues/5412
|
// see: https://github.com/ppy/osu-framework/issues/5412
|
||||||
TabControl.Current.TriggerChange();
|
TabControl.Current.TriggerChange();
|
||||||
|
|
||||||
lastCategory = category;
|
currentParameters = newParameters;
|
||||||
lastHasQuery = hasQuery;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SortTabControl CreateControl() => new BeatmapSortTabControl
|
protected override SortTabControl CreateControl() => new BeatmapSortTabControl
|
||||||
|
Loading…
Reference in New Issue
Block a user