mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Add back fallback behavior for match creation
This commit is contained in:
parent
11e353c152
commit
166a8c8bbb
@ -263,6 +263,9 @@ namespace osu.Game.Beatmaps
|
||||
if (beatmapInfo.Metadata == null)
|
||||
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
|
||||
|
||||
var info = beatmapInfo;
|
||||
beatmapInfo = QueryBeatmap(p => info.OnlineBeatmapID == p.OnlineBeatmapID) ?? beatmapInfo;
|
||||
|
||||
WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager);
|
||||
|
||||
previous?.TransferTo(working);
|
||||
|
@ -20,10 +20,13 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
private readonly BeatmapSetCoverType beatmapSetCoverType;
|
||||
|
||||
public UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType beatmapSetCoverType = BeatmapSetCoverType.Cover)
|
||||
private readonly bool fallback;
|
||||
|
||||
public UpdateableBeatmapBackgroundSprite(bool fallback = false, BeatmapSetCoverType beatmapSetCoverType = BeatmapSetCoverType.Cover)
|
||||
{
|
||||
Beatmap.BindValueChanged(b => Model = b.NewValue);
|
||||
this.beatmapSetCoverType = beatmapSetCoverType;
|
||||
this.fallback = fallback;
|
||||
}
|
||||
|
||||
protected override Drawable CreateDrawable(BeatmapInfo model)
|
||||
@ -32,11 +35,18 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
Drawable drawable;
|
||||
|
||||
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
|
||||
|
||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||
drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||
else if (fallback && localBeatmap.BeatmapInfo.ID != 0)
|
||||
{
|
||||
// Fall back to local background if one exists
|
||||
drawable = new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the default background if somehow an online set does not exist.
|
||||
// Use the default background if somehow an online set does not exist and we don't have a local copy.
|
||||
drawable = new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(null));
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
|
||||
private class MultiplayerListSprite : MultiplayerBackgroundSprite
|
||||
{
|
||||
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType.List) { RelativeSizeAxes = Axes.Both };
|
||||
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite(beatmapSetCoverType: BeatmapSetCoverType.List) { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
||||
private class RoomName : OsuSpriteText
|
||||
|
@ -132,10 +132,15 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
|
||||
private class HeaderBackgroundSprite : MultiplayerBackgroundSprite
|
||||
{
|
||||
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new BackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new BackgroundSprite(true) { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
private class BackgroundSprite : UpdateableBeatmapBackgroundSprite
|
||||
{
|
||||
public BackgroundSprite(bool fallback = false, BeatmapSetCoverType beatmapSetCoverType = BeatmapSetCoverType.Cover)
|
||||
: base(fallback, beatmapSetCoverType)
|
||||
{
|
||||
}
|
||||
|
||||
protected override double FadeDuration => 200;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user