mirror of
https://github.com/ppy/osu.git
synced 2024-12-18 01:23:05 +08:00
Use full async
flow rather than ContinueWith
This commit is contained in:
parent
6ea1623889
commit
187fa5eccd
@ -810,19 +810,19 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
protected async Task PopulateUsers(IEnumerable<MultiplayerRoomUser> multiplayerUsers)
|
protected async Task PopulateUsers(IEnumerable<MultiplayerRoomUser> multiplayerUsers)
|
||||||
{
|
{
|
||||||
var request = new GetUsersRequest(multiplayerUsers.Select(u => u.UserID).Distinct().ToArray());
|
var request = new GetUsersRequest(multiplayerUsers.Select(u => u.UserID).Distinct().ToArray());
|
||||||
await API.PerformAsync(request).ContinueWith(t =>
|
|
||||||
{
|
await API.PerformAsync(request).ConfigureAwait(false);
|
||||||
|
|
||||||
if (request.Response == null)
|
if (request.Response == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var users = request.Response.Users.ToDictionary(user => user.Id);
|
Dictionary<int, APIUser> users = request.Response.Users.ToDictionary(user => user.Id);
|
||||||
|
|
||||||
foreach (var multiplayerUser in multiplayerUsers)
|
foreach (var multiplayerUser in multiplayerUsers)
|
||||||
{
|
{
|
||||||
if (users.TryGetValue(multiplayerUser.UserID, out var user))
|
if (users.TryGetValue(multiplayerUser.UserID, out var user))
|
||||||
multiplayerUser.User = user;
|
multiplayerUser.User = user;
|
||||||
}
|
}
|
||||||
}).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user