Update ScorePerformanceCalculator code path.

This commit is contained in:
Lucas A 2020-10-07 14:10:25 +02:00
parent a425cf4a31
commit cd15f83f85
1 changed files with 2 additions and 6 deletions

View File

@ -17,9 +17,6 @@ public class ScorePerformanceManager : Component
{
private readonly ConcurrentDictionary<PerformanceCacheLookup, double> performanceCache = new ConcurrentDictionary<PerformanceCacheLookup, double>();
[Resolved]
private BeatmapManager beatmapManager { get; set; }
[Resolved]
private BeatmapDifficultyManager difficultyManager { get; set; }
@ -45,14 +42,13 @@ private bool tryGetExisting(ScoreInfo score, out double performance, out Perform
private async Task<double> computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default)
{
var beatmap = beatmapManager.GetWorkingBeatmap(score.Beatmap);
var attributes = await difficultyManager.GetDifficultyAsync(score.Beatmap, score.Ruleset, score.Mods, token);
if (token.IsCancellationRequested)
return default;
var calculator = score.Ruleset.CreateInstance().CreatePerformanceCalculator(beatmap, score, attributes.Attributes);
var total = calculator.Calculate();
var calculator = score.Ruleset.CreateInstance().CreatePerformanceCalculator(attributes.Attributes, score);
var total = calculator?.Calculate() ?? default;
performanceCache[lookupKey] = total;