Move scope/country restrictions into RankingsOverlay

This commit is contained in:
Dean Herbert 2019-12-05 14:07:39 +09:00
parent 753715f7db
commit 5f9b9631ef
2 changed files with 21 additions and 13 deletions

View File

@ -74,13 +74,7 @@ protected override void LoadComplete()
base.LoadComplete();
}
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope)
{
scopeText.Text = scope.NewValue.ToString();
if (scope.NewValue != RankingsScope.Performance)
Country.Value = null;
}
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope) => scopeText.Text = scope.NewValue.ToString();
private void onCountryChanged(ValueChangedEvent<Country> country)
{
@ -90,8 +84,6 @@ private void onCountryChanged(ValueChangedEvent<Country> country)
return;
}
Scope.Value = RankingsScope.Performance;
flag.Country = country.NewValue;
flag.Show();
}

View File

@ -98,9 +98,25 @@ private void load(OsuColour colour)
protected override void LoadComplete()
{
country.BindValueChanged(_ => redraw(), true);
scope.BindValueChanged(_ => redraw(), true);
ruleset.BindValueChanged(_ => redraw(), true);
country.BindValueChanged(_ =>
{
// if a country is requested, force performance scope.
if (country.Value != null)
scope.Value = RankingsScope.Performance;
Scheduler.AddOnce(loadNewContent);
}, true);
scope.BindValueChanged(_ =>
{
// country filtering is only valid for performance scope.
if (scope.Value != RankingsScope.Performance)
country.Value = null;
Scheduler.AddOnce(loadNewContent);
}, true);
ruleset.BindValueChanged(_ => Scheduler.AddOnce(loadNewContent), true);
base.LoadComplete();
}
@ -114,7 +130,7 @@ public void ShowCountry(Country requested)
country.Value = requested;
}
private void redraw()
private void loadNewContent()
{
scrollFlow.ScrollToStart();