mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:07:52 +08:00
Fix tournament bracket parsing regression
Closes #24136. Regressed in #24037.
This commit is contained in:
parent
65384d6125
commit
b40532dde1
@ -9,7 +9,6 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Input;
|
||||
@ -94,7 +93,7 @@ namespace osu.Game.Tournament
|
||||
Task.Run(readBracket);
|
||||
}
|
||||
|
||||
private void readBracket()
|
||||
private async Task readBracket()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -102,7 +101,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
using (Stream stream = storage.GetStream(BRACKET_FILENAME, FileAccess.Read, FileMode.Open))
|
||||
using (var sr = new StreamReader(stream))
|
||||
ladder = JsonConvert.DeserializeObject<LadderInfo>(sr.ReadToEnd(), new JsonPointConverter());
|
||||
ladder = JsonConvert.DeserializeObject<LadderInfo>(await sr.ReadToEndAsync().ConfigureAwait(false), new JsonPointConverter());
|
||||
}
|
||||
|
||||
ladder ??= new LadderInfo();
|
||||
@ -166,8 +165,8 @@ namespace osu.Game.Tournament
|
||||
}
|
||||
|
||||
addedInfo |= addPlayers();
|
||||
addedInfo |= addRoundBeatmaps();
|
||||
addedInfo |= addSeedingBeatmaps();
|
||||
addedInfo |= await addRoundBeatmaps().ConfigureAwait(false);
|
||||
addedInfo |= await addSeedingBeatmaps().ConfigureAwait(false);
|
||||
|
||||
if (addedInfo)
|
||||
saveChanges();
|
||||
@ -233,7 +232,7 @@ namespace osu.Game.Tournament
|
||||
/// <summary>
|
||||
/// Add missing beatmap info based on beatmap IDs
|
||||
/// </summary>
|
||||
private bool addRoundBeatmaps()
|
||||
private async Task<bool> addRoundBeatmaps()
|
||||
{
|
||||
var beatmapsRequiringPopulation = ladder.Rounds
|
||||
.SelectMany(r => r.Beatmaps)
|
||||
@ -246,7 +245,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var b = beatmapsRequiringPopulation[i];
|
||||
|
||||
b.Beatmap = new TournamentBeatmap(beatmapCache.GetBeatmapAsync(b.ID).GetResultSafely() ?? new APIBeatmap());
|
||||
b.Beatmap = new TournamentBeatmap(await beatmapCache.GetBeatmapAsync(b.ID).ConfigureAwait(false) ?? new APIBeatmap());
|
||||
|
||||
updateLoadProgressMessage($"Populating round beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||
}
|
||||
@ -257,7 +256,7 @@ namespace osu.Game.Tournament
|
||||
/// <summary>
|
||||
/// Add missing beatmap info based on beatmap IDs
|
||||
/// </summary>
|
||||
private bool addSeedingBeatmaps()
|
||||
private async Task<bool> addSeedingBeatmaps()
|
||||
{
|
||||
var beatmapsRequiringPopulation = ladder.Teams
|
||||
.SelectMany(r => r.SeedingResults)
|
||||
@ -271,7 +270,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var b = beatmapsRequiringPopulation[i];
|
||||
|
||||
b.Beatmap = new TournamentBeatmap(beatmapCache.GetBeatmapAsync(b.ID).GetResultSafely() ?? new APIBeatmap());
|
||||
b.Beatmap = new TournamentBeatmap(await beatmapCache.GetBeatmapAsync(b.ID).ConfigureAwait(false) ?? new APIBeatmap());
|
||||
|
||||
updateLoadProgressMessage($"Populating seeding beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user