mirror of
https://github.com/ppy/osu.git
synced 2024-11-18 20:13:02 +08:00
32 lines
1.2 KiB
C#
32 lines
1.2 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.
|
|
|
|
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);
|
|
}
|
|
}
|