Update PresentBeatmap to support interface types

This commit is contained in:
Dean Herbert
2021-10-29 17:40:12 +09:00
parent b5834044e0
commit 90503f72ca

View File

@ -436,11 +436,15 @@ namespace osu.Game
/// <item>first beatmap from any ruleset.</item> /// <item>first beatmap from any ruleset.</item>
/// </list> /// </list>
/// </remarks> /// </remarks>
public void PresentBeatmap(BeatmapSetInfo beatmap, Predicate<BeatmapInfo> difficultyCriteria = null) public void PresentBeatmap(IBeatmapSetInfo beatmap, Predicate<BeatmapInfo> difficultyCriteria = null)
{ {
var databasedSet = beatmap.OnlineBeatmapSetID != null BeatmapSetInfo databasedSet = null;
? BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID)
: BeatmapManager.QueryBeatmapSet(s => s.Hash == beatmap.Hash); if (beatmap.OnlineID > 0)
databasedSet = BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineID);
if (beatmap is BeatmapSetInfo localBeatmap)
databasedSet ??= BeatmapManager.QueryBeatmapSet(s => s.Hash == localBeatmap.Hash);
if (databasedSet == null) if (databasedSet == null)
{ {