Reforamt for legibility

This commit is contained in:
Dean Herbert 2020-11-09 12:22:54 +09:00
parent dc69eefa51
commit 690e69bcc6

View File

@ -53,22 +53,26 @@ namespace osu.Game.Overlays.Dashboard
base.LoadComplete(); base.LoadComplete();
playingUsers.BindTo(spectatorStreaming.PlayingUsers); playingUsers.BindTo(spectatorStreaming.PlayingUsers);
playingUsers.BindCollectionChanged((sender, e) => Schedule(() => playingUsers.BindCollectionChanged(onUsersChanged, true);
}
private void onUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() =>
{ {
switch (e.Action) switch (e.Action)
{ {
case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Add:
foreach (var id in e.NewItems.OfType<int>().ToArray()) foreach (var id in e.NewItems.OfType<int>().ToArray())
{ {
users.GetUserAsync(id).ContinueWith(u => users.GetUserAsync(id).ContinueWith(u =>
{ {
if (u.Result == null) if (u.Result == null) return;
return;
Schedule(() => Schedule(() =>
{ {
if (playingUsers.Contains(u.Result.Id)) // user may no longer be playing.
if (!playingUsers.Contains(u.Result.Id))
return;
userFlow.Add(createUserPanel(u.Result)); userFlow.Add(createUserPanel(u.Result));
}); });
}); });
@ -85,8 +89,7 @@ namespace osu.Game.Overlays.Dashboard
userFlow.Clear(); userFlow.Clear();
break; break;
} }
}), true); });
}
private PlayingUserPanel createUserPanel(User user) => private PlayingUserPanel createUserPanel(User user) =>
new PlayingUserPanel(user).With(panel => new PlayingUserPanel(user).With(panel =>