2018-05-15 14:27:57 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
2018-11-28 15:12:57 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2018-05-15 14:27:57 +08:00
|
|
|
|
|
2018-11-28 15:12:57 +08:00
|
|
|
|
namespace osu.Game.Scoring.Legacy
|
2018-05-15 14:27:57 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A <see cref="LegacyScoreParser"/> which retrieves the applicable <see cref="Beatmap"/> and <see cref="Ruleset"/>
|
|
|
|
|
/// for the score from the database.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DatabasedLegacyScoreParser : LegacyScoreParser
|
|
|
|
|
{
|
|
|
|
|
private readonly RulesetStore rulesets;
|
|
|
|
|
private readonly BeatmapManager beatmaps;
|
|
|
|
|
|
|
|
|
|
public DatabasedLegacyScoreParser(RulesetStore rulesets, BeatmapManager beatmaps)
|
|
|
|
|
{
|
|
|
|
|
this.rulesets = rulesets;
|
|
|
|
|
this.beatmaps = beatmaps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
|
|
|
|
|
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => b.MD5Hash == md5Hash));
|
|
|
|
|
}
|
|
|
|
|
}
|