1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge pull request #26587 from peppy/fix-tournament-panel-load

Fix tournament beatmap backgrounds occasionally not loading
This commit is contained in:
Bartłomiej Dach 2024-01-18 14:54:37 +01:00 committed by GitHub
commit e24074f239
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 5 deletions

View File

@ -12,6 +12,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Legacy;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Models;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK; using osuTK;
@ -101,11 +102,25 @@ namespace osu.Game.Tournament.Components
private void refreshContent() private void refreshContent()
{ {
if (beatmap == null) beatmap ??= new BeatmapInfo
{ {
flow.Clear(); Metadata = new BeatmapMetadata
return; {
} Artist = "unknown",
Title = "no beatmap selected",
Author = new RealmUser { Username = "unknown" },
},
DifficultyName = "unknown",
BeatmapSet = new BeatmapSetInfo(),
StarRating = 0,
Difficulty = new BeatmapDifficulty
{
CircleSize = 0,
DrainRate = 0,
OverallDifficulty = 0,
ApproachRate = 0,
},
};
double bpm = beatmap.BPM; double bpm = beatmap.BPM;
double length = beatmap.Length; double length = beatmap.Length;

View File

@ -194,7 +194,7 @@ namespace osu.Game.Tournament.Components
// Use DelayedLoadWrapper to avoid content unloading when switching away to another screen. // Use DelayedLoadWrapper to avoid content unloading when switching away to another screen.
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad) protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
=> new DelayedLoadWrapper(createContentFunc, timeBeforeLoad); => new DelayedLoadWrapper(createContentFunc(), timeBeforeLoad);
} }
} }
} }