2019-01-24 08:43:03 +00:00
|
|
|
|
// 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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-03-14 05:25:26 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2018-11-28 07:12:57 +00:00
|
|
|
|
using osu.Game.Scoring;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-05-15 08:38:04 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Difficulty
|
2017-11-17 03:35:23 +00:00
|
|
|
|
{
|
|
|
|
|
public abstract class PerformanceCalculator
|
|
|
|
|
{
|
2018-05-15 16:43:58 +00:00
|
|
|
|
protected readonly Ruleset Ruleset;
|
2018-05-14 02:15:14 +00:00
|
|
|
|
|
2022-03-14 05:25:26 +00:00
|
|
|
|
protected PerformanceCalculator(Ruleset ruleset)
|
2017-11-17 03:35:23 +00:00
|
|
|
|
{
|
2018-05-15 16:43:58 +00:00
|
|
|
|
Ruleset = ruleset;
|
2018-05-14 02:15:14 +00:00
|
|
|
|
}
|
2018-05-14 02:52:22 +00:00
|
|
|
|
|
2022-03-14 05:25:26 +00:00
|
|
|
|
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));
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-03-14 05:25:26 +00:00
|
|
|
|
/// <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);
|
2017-11-17 03:35:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|