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-05-15 06:27:57 +00:00
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
2018-11-28 07:12:57 +00:00
|
|
|
|
using osu.Game.Rulesets;
|
2018-05-15 06:27:57 +00:00
|
|
|
|
|
2018-11-28 07:12:57 +00:00
|
|
|
|
namespace osu.Game.Scoring.Legacy
|
2018-05-15 06:27:57 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2020-03-24 01:38:24 +00:00
|
|
|
|
/// A <see cref="LegacyScoreDecoder"/> which retrieves the applicable <see cref="Beatmap"/> and <see cref="Ruleset"/>
|
2018-05-15 06:27:57 +00:00
|
|
|
|
/// for the score from the database.
|
|
|
|
|
/// </summary>
|
2020-03-24 01:38:24 +00:00
|
|
|
|
public class DatabasedLegacyScoreDecoder : LegacyScoreDecoder
|
2018-05-15 06:27:57 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly RulesetStore rulesets;
|
|
|
|
|
private readonly BeatmapManager beatmaps;
|
|
|
|
|
|
2020-03-24 01:38:24 +00:00
|
|
|
|
public DatabasedLegacyScoreDecoder(RulesetStore rulesets, BeatmapManager beatmaps)
|
2018-05-15 06:27:57 +00:00
|
|
|
|
{
|
|
|
|
|
this.rulesets = rulesets;
|
|
|
|
|
this.beatmaps = beatmaps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
|
2019-09-20 10:39:21 +00:00
|
|
|
|
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.MD5Hash == md5Hash));
|
2018-05-15 06:27:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|