osu/osu.Game/Rulesets/Difficulty/PerformanceCalculator.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1.2 KiB
C#
Raw Normal View History

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