1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 03:27:25 +08:00
osu-lazer/osu.Game/Overlays/Dashboard/Friends/FriendsOnlineStatusControl.cs
2020-03-17 08:51:54 +03:00

26 lines
941 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.Users;
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<User> 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();
}
}
}