1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 10:07:36 +08:00

Use local bindable

This commit is contained in:
Dean Herbert 2017-12-21 23:48:35 +09:00
parent 4bd2c7e95f
commit 65e6206d06

View File

@ -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<LeaderboardScore> scrollFlow;
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
public Action<Score> 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)