1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 23:03:21 +08:00
osu-lazer/osu.Game/Overlays/Dashboard/Friends/FriendsOnlineStatusControl.cs
2020-03-16 09:42:21 +03:00

26 lines
970 B
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Dashboard.Friends
{
public class FriendsOnlineStatusControl : OverlayStreamControl<FriendsBundle>
{
protected override OverlayStreamItem<FriendsBundle> CreateStreamItem(FriendsBundle value) => new FriendsOnlineStatusItem(value);
public void Populate(List<APIFriend> users)
{
Clear();
AddItem(new FriendsBundle(FriendsOnlineStatus.All, users));
AddItem(new FriendsBundle(FriendsOnlineStatus.Online, users.Where(u => u.IsOnline).ToList()));
AddItem(new FriendsBundle(FriendsOnlineStatus.Offline, users.Where(u => !u.IsOnline).ToList()));
Current.Value = Items.FirstOrDefault();
}
}
}