1
0
Fork 0
mirror of https://github.com/ppy/osu-tools.git synced 2025-06-07 23:07:01 +09:00
osu-tools/PerformanceCalculatorGUI/ProcessorScoreDecoder.cs
2025-05-13 15:04:42 +01:00

37 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.Database;
using osu.Game.Rulesets;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
namespace PerformanceCalculatorGUI
{
/// <summary>
/// A <see cref="LegacyScoreDecoder"/> which has a predefined beatmap and rulesets.
/// </summary>
public class ProcessorScoreDecoder : LegacyScoreDecoder
{
private readonly WorkingBeatmap beatmap;
public ProcessorScoreDecoder(WorkingBeatmap beatmap)
{
this.beatmap = beatmap;
}
public Score Parse(ScoreInfo scoreInfo)
{
var score = new Score { ScoreInfo = scoreInfo };
score.ScoreInfo.LegacyTotalScore ??= score.ScoreInfo.TotalScore;
PopulateMaximumStatistics(score.ScoreInfo, beatmap);
StandardisedScoreMigrationTools.UpdateFromLegacy(score.ScoreInfo, beatmap);
return score;
}
protected override Ruleset GetRuleset(int rulesetId) => RulesetHelper.GetRulesetFromLegacyID(rulesetId);
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmap;
}
}