Privatise game ruleset and access via DI

Also decouples the bindable at SongSelect, where it is debounced in line with the carousel being updated.
This commit is contained in:
Dean Herbert
2018-06-26 16:32:20 +09:00
parent a8579c49f9
commit b0a1b25983
9 changed files with 39 additions and 37 deletions

View File

@ -174,7 +174,6 @@ namespace osu.Game.Screens.Select.Leaderboards
private APIAccess api;
private BeatmapInfo beatmap;
private OsuGame osuGame;
private ScheduledDelegate pendingBeatmapSwitch;
@ -195,15 +194,14 @@ namespace osu.Game.Screens.Select.Leaderboards
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, OsuGame osuGame)
private void load(APIAccess api, Bindable<RulesetInfo> parentRuleset)
{
this.api = api;
this.osuGame = osuGame;
if (osuGame != null)
ruleset.BindTo(osuGame.Ruleset);
if (parentRuleset != null)
ruleset.BindTo(parentRuleset);
ruleset.ValueChanged += r => updateScores();
ruleset.ValueChanged += _ => updateScores();
if (api != null)
api.OnStateChange += handleApiStateChange;