mirror of
https://github.com/ppy/osu.git
synced 2024-12-30 07:52:56 +08:00
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
#nullable disable
|
|
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Scoring;
|
|
|
|
namespace osu.Game.Rulesets.Difficulty
|
|
{
|
|
public abstract class PerformanceCalculator
|
|
{
|
|
protected readonly Ruleset Ruleset;
|
|
|
|
protected PerformanceCalculator(Ruleset ruleset)
|
|
{
|
|
Ruleset = ruleset;
|
|
}
|
|
|
|
public PerformanceAttributes Calculate(ScoreInfo score, DifficultyAttributes attributes)
|
|
=> CreatePerformanceAttributes(score, attributes);
|
|
|
|
public PerformanceAttributes Calculate(ScoreInfo score, IWorkingBeatmap beatmap)
|
|
=> Calculate(score, Ruleset.CreateDifficultyCalculator(beatmap).Calculate(score.Mods));
|
|
|
|
/// <summary>
|
|
/// Creates <see cref="PerformanceAttributes"/> to describe a score's performance.
|
|
/// </summary>
|
|
/// <param name="score">The score to create the attributes for.</param>
|
|
/// <param name="attributes">The difficulty attributes for the beatmap relating to the score.</param>
|
|
protected abstract PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes);
|
|
}
|
|
}
|