mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Update UpdateableBeatmapBackgroundSprite
to accept IBeatmapInfo
This commit is contained in:
@ -12,9 +12,9 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
/// <summary>
|
||||
/// Display a beatmap background from a local source, but fallback to online source if not available.
|
||||
/// </summary>
|
||||
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<BeatmapInfo>
|
||||
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<IBeatmapInfo>
|
||||
{
|
||||
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
|
||||
|
||||
protected override double LoadDelay => 500;
|
||||
|
||||
@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
protected override double TransformDuration => 400;
|
||||
|
||||
protected override Drawable CreateDrawable(BeatmapInfo model)
|
||||
protected override Drawable CreateDrawable(IBeatmapInfo model)
|
||||
{
|
||||
var drawable = getDrawableForModel(model);
|
||||
drawable.RelativeSizeAxes = Axes.Both;
|
||||
@ -50,15 +50,16 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private Drawable getDrawableForModel(BeatmapInfo model)
|
||||
private Drawable getDrawableForModel(IBeatmapInfo model)
|
||||
{
|
||||
// prefer online cover where available.
|
||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||
return new OnlineBeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||
if (model?.BeatmapSet is IBeatmapSetOnlineInfo online)
|
||||
return new OnlineBeatmapSetCover(online, beatmapSetCoverType);
|
||||
|
||||
return model?.ID > 0
|
||||
? new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model))
|
||||
: new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
if (model is BeatmapInfo localModel)
|
||||
return new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(localModel));
|
||||
|
||||
return new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user