mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 23:57:25 +08:00
Ensure score's user is set directly from API
Previously would fail in visualtests due to `OsuGame` case.
This commit is contained in:
parent
841805f8f0
commit
803cbddfe2
@ -23,6 +23,7 @@ using osu.Game.Rulesets.Scoring;
|
|||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -50,6 +51,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private RulesetInfo ruleset;
|
private RulesetInfo ruleset;
|
||||||
|
|
||||||
|
private APIAccess api;
|
||||||
|
|
||||||
private ScoreProcessor scoreProcessor;
|
private ScoreProcessor scoreProcessor;
|
||||||
protected RulesetContainer RulesetContainer;
|
protected RulesetContainer RulesetContainer;
|
||||||
|
|
||||||
@ -69,9 +72,12 @@ namespace osu.Game.Screens.Play
|
|||||||
private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
|
private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(AudioManager audio, OsuConfigManager config, OsuGame osu)
|
private void load(AudioManager audio, OsuConfigManager config, OsuGame osu, APIAccess api)
|
||||||
{
|
{
|
||||||
|
this.api = api;
|
||||||
|
|
||||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
|
|
||||||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||||
|
|
||||||
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
||||||
@ -235,7 +241,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Ruleset = ruleset
|
Ruleset = ruleset
|
||||||
};
|
};
|
||||||
scoreProcessor.PopulateScore(score);
|
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));
|
Push(new Results(score));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user