1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 11:22:54 +08:00

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 @@ namespace osu.Game.Overlays.Rankings
base.LoadComplete(); base.LoadComplete();
} }
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope) private void onScopeChanged(ValueChangedEvent<RankingsScope> scope) => scopeText.Text = scope.NewValue.ToString();
{
scopeText.Text = scope.NewValue.ToString();
if (scope.NewValue != RankingsScope.Performance)
Country.Value = null;
}
private void onCountryChanged(ValueChangedEvent<Country> country) private void onCountryChanged(ValueChangedEvent<Country> country)
{ {
@ -90,8 +84,6 @@ namespace osu.Game.Overlays.Rankings
return; return;
} }
Scope.Value = RankingsScope.Performance;
flag.Country = country.NewValue; flag.Country = country.NewValue;
flag.Show(); flag.Show();
} }

View File

@ -98,9 +98,25 @@ namespace osu.Game.Overlays
protected override void LoadComplete() protected override void LoadComplete()
{ {
country.BindValueChanged(_ => redraw(), true); country.BindValueChanged(_ =>
scope.BindValueChanged(_ => redraw(), true); {
ruleset.BindValueChanged(_ => redraw(), true); // 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(); base.LoadComplete();
} }
@ -114,7 +130,7 @@ namespace osu.Game.Overlays
country.Value = requested; country.Value = requested;
} }
private void redraw() private void loadNewContent()
{ {
scrollFlow.ScrollToStart(); scrollFlow.ScrollToStart();