mirror of
https://github.com/ppy/osu
synced 2025-01-08 23:29:43 +00:00
Use async difficulty calculation
This commit is contained in:
parent
1e5e5cae0c
commit
39f8b5eb85
@ -108,6 +108,8 @@ namespace osu.Game.Scoring
|
||||
ScoringMode.BindValueChanged(onScoringModeChanged, true);
|
||||
}
|
||||
|
||||
private IBindable<StarDifficulty> difficultyBindable;
|
||||
|
||||
private void onScoringModeChanged(ValueChangedEvent<ScoringMode> mode)
|
||||
{
|
||||
int? beatmapMaxCombo = score.Beatmap.MaxCombo;
|
||||
@ -121,19 +123,25 @@ namespace osu.Game.Scoring
|
||||
return;
|
||||
}
|
||||
|
||||
// We can compute the max combo locally.
|
||||
beatmapMaxCombo = difficulties().GetDifficulty(score.Beatmap, score.Ruleset, score.Mods).MaxCombo;
|
||||
// We can compute the max combo locally after the async beatmap difficulty computation.
|
||||
difficultyBindable = difficulties().GetBindableDifficulty(score.Beatmap, score.Ruleset, score.Mods);
|
||||
difficultyBindable.BindValueChanged(d => updateScore(d.NewValue.MaxCombo), true);
|
||||
}
|
||||
else
|
||||
updateScore(beatmapMaxCombo.Value);
|
||||
}
|
||||
|
||||
private void updateScore(int beatmapMaxCombo)
|
||||
{
|
||||
var ruleset = score.Ruleset.CreateInstance();
|
||||
var scoreProcessor = ruleset.CreateScoreProcessor();
|
||||
|
||||
scoreProcessor.Mods.Value = score.Mods;
|
||||
|
||||
double maxBaseScore = 300 * beatmapMaxCombo.Value;
|
||||
double maxHighestCombo = beatmapMaxCombo.Value;
|
||||
double maxBaseScore = 300 * beatmapMaxCombo;
|
||||
double maxHighestCombo = beatmapMaxCombo;
|
||||
|
||||
Value = Math.Round(scoreProcessor.GetScore(mode.NewValue, maxBaseScore, maxHighestCombo, score.Accuracy, score.MaxCombo / maxHighestCombo, 0)).ToString("N0");
|
||||
Value = Math.Round(scoreProcessor.GetScore(ScoringMode.Value, maxBaseScore, maxHighestCombo, score.Accuracy, score.MaxCombo / maxHighestCombo, 0)).ToString("N0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user