mirror of
https://github.com/ppy/osu
synced 2024-12-16 11:56:31 +00:00
Merge pull request #24139 from peppy/fix-tourney-read-bracket
Fix tournament bracket parsing regression
This commit is contained in:
commit
001d09057e
@ -9,7 +9,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -94,7 +93,7 @@ namespace osu.Game.Tournament
|
|||||||
Task.Run(readBracket);
|
Task.Run(readBracket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readBracket()
|
private async Task readBracket()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -102,7 +101,7 @@ namespace osu.Game.Tournament
|
|||||||
{
|
{
|
||||||
using (Stream stream = storage.GetStream(BRACKET_FILENAME, FileAccess.Read, FileMode.Open))
|
using (Stream stream = storage.GetStream(BRACKET_FILENAME, FileAccess.Read, FileMode.Open))
|
||||||
using (var sr = new StreamReader(stream))
|
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();
|
ladder ??= new LadderInfo();
|
||||||
@ -166,8 +165,8 @@ namespace osu.Game.Tournament
|
|||||||
}
|
}
|
||||||
|
|
||||||
addedInfo |= addPlayers();
|
addedInfo |= addPlayers();
|
||||||
addedInfo |= addRoundBeatmaps();
|
addedInfo |= await addRoundBeatmaps().ConfigureAwait(false);
|
||||||
addedInfo |= addSeedingBeatmaps();
|
addedInfo |= await addSeedingBeatmaps().ConfigureAwait(false);
|
||||||
|
|
||||||
if (addedInfo)
|
if (addedInfo)
|
||||||
saveChanges();
|
saveChanges();
|
||||||
@ -233,7 +232,7 @@ namespace osu.Game.Tournament
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add missing beatmap info based on beatmap IDs
|
/// Add missing beatmap info based on beatmap IDs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool addRoundBeatmaps()
|
private async Task<bool> addRoundBeatmaps()
|
||||||
{
|
{
|
||||||
var beatmapsRequiringPopulation = ladder.Rounds
|
var beatmapsRequiringPopulation = ladder.Rounds
|
||||||
.SelectMany(r => r.Beatmaps)
|
.SelectMany(r => r.Beatmaps)
|
||||||
@ -246,7 +245,7 @@ namespace osu.Game.Tournament
|
|||||||
{
|
{
|
||||||
var b = beatmapsRequiringPopulation[i];
|
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})");
|
updateLoadProgressMessage($"Populating round beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||||
}
|
}
|
||||||
@ -257,7 +256,7 @@ namespace osu.Game.Tournament
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add missing beatmap info based on beatmap IDs
|
/// Add missing beatmap info based on beatmap IDs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool addSeedingBeatmaps()
|
private async Task<bool> addSeedingBeatmaps()
|
||||||
{
|
{
|
||||||
var beatmapsRequiringPopulation = ladder.Teams
|
var beatmapsRequiringPopulation = ladder.Teams
|
||||||
.SelectMany(r => r.SeedingResults)
|
.SelectMany(r => r.SeedingResults)
|
||||||
@ -271,7 +270,7 @@ namespace osu.Game.Tournament
|
|||||||
{
|
{
|
||||||
var b = beatmapsRequiringPopulation[i];
|
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})");
|
updateLoadProgressMessage($"Populating seeding beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user