mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:20:04 +08:00
Reforamt for legibility
This commit is contained in:
parent
dc69eefa51
commit
690e69bcc6
@ -53,22 +53,26 @@ namespace osu.Game.Overlays.Dashboard
|
||||
base.LoadComplete();
|
||||
|
||||
playingUsers.BindTo(spectatorStreaming.PlayingUsers);
|
||||
playingUsers.BindCollectionChanged((sender, e) => Schedule(() =>
|
||||
playingUsers.BindCollectionChanged(onUsersChanged, true);
|
||||
}
|
||||
|
||||
private void onUsersChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() =>
|
||||
{
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
|
||||
foreach (var id in e.NewItems.OfType<int>().ToArray())
|
||||
{
|
||||
users.GetUserAsync(id).ContinueWith(u =>
|
||||
{
|
||||
if (u.Result == null)
|
||||
return;
|
||||
if (u.Result == null) return;
|
||||
|
||||
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));
|
||||
});
|
||||
});
|
||||
@ -85,8 +89,7 @@ namespace osu.Game.Overlays.Dashboard
|
||||
userFlow.Clear();
|
||||
break;
|
||||
}
|
||||
}), true);
|
||||
}
|
||||
});
|
||||
|
||||
private PlayingUserPanel createUserPanel(User user) =>
|
||||
new PlayingUserPanel(user).With(panel =>
|
||||
|
Loading…
Reference in New Issue
Block a user