2019-01-24 16:43:03 +08: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 14:27:57 +08:00
|
|
|
|
|
|
|
|
|
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>
|
2020-03-24 09:38:24 +08:00
|
|
|
|
/// A <see cref="LegacyScoreDecoder"/> which retrieves the applicable <see cref="Beatmap"/> and <see cref="Ruleset"/>
|
2018-05-15 14:27:57 +08:00
|
|
|
|
/// for the score from the database.
|
|
|
|
|
/// </summary>
|
2020-03-24 09:38:24 +08:00
|
|
|
|
public class DatabasedLegacyScoreDecoder : LegacyScoreDecoder
|
2018-05-15 14:27:57 +08:00
|
|
|
|
{
|
2021-12-03 16:50:40 +08:00
|
|
|
|
private readonly IRulesetStore rulesets;
|
2018-05-15 14:27:57 +08:00
|
|
|
|
private readonly BeatmapManager beatmaps;
|
|
|
|
|
|
2021-12-03 16:50:40 +08:00
|
|
|
|
public DatabasedLegacyScoreDecoder(IRulesetStore rulesets, BeatmapManager beatmaps)
|
2018-05-15 14:27:57 +08:00
|
|
|
|
{
|
|
|
|
|
this.rulesets = rulesets;
|
|
|
|
|
this.beatmaps = beatmaps;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-07 16:27:48 +08:00
|
|
|
|
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId)?.CreateInstance();
|
|
|
|
|
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => b.MD5Hash == md5Hash));
|
2018-05-15 14:27:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|