diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 52b152b42f..50c16ed04d 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -18,6 +18,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using System.Linq; +using osu.Framework.Configuration; using osu.Game.Graphics.Sprites; using osu.Game.Graphics; using osu.Framework.Logging; @@ -35,6 +36,8 @@ namespace osu.Game.Screens.Select.Leaderboards private FillFlowContainer scrollFlow; + private readonly Bindable ruleset = new Bindable(); + public Action ScoreSelected; private readonly LoadingAnimation loading; @@ -185,7 +188,9 @@ namespace osu.Game.Screens.Select.Leaderboards this.osuGame = osuGame; if (osuGame != null) - osuGame.Ruleset.ValueChanged += handleRulesetChange; + ruleset.BindTo(osuGame.Ruleset); + + ruleset.ValueChanged += r => updateScores(); if (api != null) api.OnStateChange += handleApiStateChange; @@ -195,17 +200,12 @@ namespace osu.Game.Screens.Select.Leaderboards { base.Dispose(isDisposing); - if (osuGame != null) - osuGame.Ruleset.ValueChanged -= handleRulesetChange; - if (api != null) api.OnStateChange -= handleApiStateChange; } private GetScoresRequest getScoresRequest; - private void handleRulesetChange(RulesetInfo ruleset) => updateScores(); - private void handleApiStateChange(APIState oldState, APIState newState) { if (Scope == LeaderboardScope.Local)