diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3f399d69e6..615e04d6c2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -23,6 +23,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Framework.Audio.Sample; using osu.Game.Beatmaps; +using osu.Game.Online.API; namespace osu.Game.Screens.Play { @@ -50,6 +51,8 @@ namespace osu.Game.Screens.Play private RulesetInfo ruleset; + private APIAccess api; + private ScoreProcessor scoreProcessor; protected RulesetContainer RulesetContainer; @@ -68,10 +71,13 @@ namespace osu.Game.Screens.Play private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(AudioManager audio, OsuConfigManager config, OsuGame osu) + [BackgroundDependencyLoader] + private void load(AudioManager audio, OsuConfigManager config, APIAccess api) { + this.api = api; + dimLevel = config.GetBindable(OsuSetting.DimLevel); + mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); sampleRestart = audio.Sample.Get(@"Gameplay/restart"); @@ -86,7 +92,7 @@ namespace osu.Game.Screens.Play if (beatmap == null) throw new InvalidOperationException("Beatmap was not loaded"); - ruleset = osu?.Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset; + ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset; var rulesetInstance = ruleset.CreateInstance(); try @@ -235,7 +241,7 @@ namespace osu.Game.Screens.Play Ruleset = ruleset }; scoreProcessor.PopulateScore(score); - score.User = RulesetContainer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; + score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; Push(new Results(score)); }); }