mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 02:32:59 +08:00
Update ScorePerformanceCalculator code path.
This commit is contained in:
parent
a425cf4a31
commit
cd15f83f85
@ -17,9 +17,6 @@ namespace osu.Game.Scoring
|
|||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<PerformanceCacheLookup, double> performanceCache = new ConcurrentDictionary<PerformanceCacheLookup, double>();
|
private readonly ConcurrentDictionary<PerformanceCacheLookup, double> performanceCache = new ConcurrentDictionary<PerformanceCacheLookup, double>();
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyManager difficultyManager { get; set; }
|
||||||
|
|
||||||
@ -45,14 +42,13 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
private async Task<double> computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default)
|
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);
|
var attributes = await difficultyManager.GetDifficultyAsync(score.Beatmap, score.Ruleset, score.Mods, token);
|
||||||
|
|
||||||
if (token.IsCancellationRequested)
|
if (token.IsCancellationRequested)
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
var calculator = score.Ruleset.CreateInstance().CreatePerformanceCalculator(beatmap, score, attributes.Attributes);
|
var calculator = score.Ruleset.CreateInstance().CreatePerformanceCalculator(attributes.Attributes, score);
|
||||||
var total = calculator.Calculate();
|
var total = calculator?.Calculate() ?? default;
|
||||||
|
|
||||||
performanceCache[lookupKey] = total;
|
performanceCache[lookupKey] = total;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user