mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Fix handling of API responses
This commit is contained in:
parent
0bc4a01a6b
commit
056025c5c2
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -39,6 +40,8 @@ namespace osu.Game.Tournament.Components
|
|||||||
|
|
||||||
public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null)
|
public TournamentBeatmapPanel(BeatmapInfo beatmap, string mods = null)
|
||||||
{
|
{
|
||||||
|
if (beatmap == null) throw new ArgumentNullException(nameof(beatmap));
|
||||||
|
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
this.mods = mods;
|
this.mods = mods;
|
||||||
Width = 400;
|
Width = 400;
|
||||||
|
@ -113,8 +113,8 @@ namespace osu.Game.Tournament
|
|||||||
if (string.IsNullOrEmpty(p.Username))
|
if (string.IsNullOrEmpty(p.Username))
|
||||||
{
|
{
|
||||||
var req = new GetUserRequest(p.Id);
|
var req = new GetUserRequest(p.Id);
|
||||||
req.Success += i => p.Username = i.Username;
|
|
||||||
req.Perform(API);
|
req.Perform(API);
|
||||||
|
p.Username = req.Result.Username;
|
||||||
|
|
||||||
addedInfo = true;
|
addedInfo = true;
|
||||||
}
|
}
|
||||||
@ -125,8 +125,8 @@ namespace osu.Game.Tournament
|
|||||||
if (b.BeatmapInfo == null)
|
if (b.BeatmapInfo == null)
|
||||||
{
|
{
|
||||||
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
|
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
|
||||||
req.Success += i => b.BeatmapInfo = i.ToBeatmap(RulesetStore);
|
|
||||||
req.Perform(API);
|
req.Perform(API);
|
||||||
|
b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore);
|
||||||
|
|
||||||
addedInfo = true;
|
addedInfo = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user