1
0
Fork 0
mirror of https://github.com/ppy/osu-tools.git synced 2025-06-07 23:07:01 +09:00
osu-tools/PerformanceCalculator/ProcessorScoreParser.cs
2019-01-24 18:48:24 +09:00

34 lines
1 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.Rulesets;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
namespace PerformanceCalculator
{
/// <summary>
/// A <see cref="LegacyScoreParser"/> which has a predefined beatmap and rulesets.
/// </summary>
public class ProcessorScoreParser : LegacyScoreParser
{
private readonly WorkingBeatmap beatmap;
public ProcessorScoreParser(WorkingBeatmap beatmap)
{
this.beatmap = beatmap;
}
public Score Parse(ScoreInfo scoreInfo)
{
var score = new Score { ScoreInfo = scoreInfo };
CalculateAccuracy(score.ScoreInfo);
return score;
}
protected override Ruleset GetRuleset(int rulesetId) => LegacyHelper.GetRulesetFromLegacyID(rulesetId);
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmap;
}
}