mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:07:29 +08:00
Consume ability to lookup multiple users in MultiplayerGameplayLeaderboard
Avoids syncrhonously blocking on asynchronous operations (which was leading to LCA starvation in tests).
This commit is contained in:
parent
9c311a6d8a
commit
77adf687c6
@ -125,9 +125,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
{
|
||||
const float padding = 44; // enough margin to avoid the hit error display.
|
||||
|
||||
leaderboard.Position = new Vector2(
|
||||
padding,
|
||||
padding + HUDOverlay.TopScoringElementsHeight);
|
||||
leaderboard.Position = new Vector2(padding, padding + HUDOverlay.TopScoringElementsHeight);
|
||||
}
|
||||
|
||||
private void onMatchStarted() => Scheduler.Add(() =>
|
||||
|
@ -53,22 +53,22 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
scoringMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
|
||||
|
||||
foreach (var userId in playingUsers)
|
||||
userLookupCache.GetUsersAsync(playingUsers.ToArray()).ContinueWith(users => Schedule(() =>
|
||||
{
|
||||
// probably won't be required in the final implementation.
|
||||
var resolvedUser = userLookupCache.GetUserAsync(userId).Result;
|
||||
|
||||
var trackedUser = CreateUserData(userId, scoreProcessor);
|
||||
foreach (var user in users.Result)
|
||||
{
|
||||
var trackedUser = CreateUserData(user.Id, scoreProcessor);
|
||||
trackedUser.ScoringMode.BindTo(scoringMode);
|
||||
|
||||
var leaderboardScore = AddPlayer(resolvedUser, resolvedUser?.Id == api.LocalUser.Value.Id);
|
||||
var leaderboardScore = AddPlayer(user, user.Id == api.LocalUser.Value.Id);
|
||||
leaderboardScore.Accuracy.BindTo(trackedUser.Accuracy);
|
||||
leaderboardScore.TotalScore.BindTo(trackedUser.Score);
|
||||
leaderboardScore.Combo.BindTo(trackedUser.CurrentCombo);
|
||||
leaderboardScore.HasQuit.BindTo(trackedUser.UserQuit);
|
||||
|
||||
UserScores[userId] = trackedUser;
|
||||
UserScores[user.Id] = trackedUser;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
Loading…
Reference in New Issue
Block a user