2023-01-11 15:47:29 +08:00
|
|
|
|
// 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.Linq;
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Header.Components
|
|
|
|
|
{
|
|
|
|
|
public partial class GroupBadgeFlow : FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
|
|
|
|
|
|
|
|
|
public GroupBadgeFlow()
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Direction = FillDirection.Horizontal;
|
|
|
|
|
Spacing = new Vector2(2);
|
|
|
|
|
|
2023-01-11 15:48:47 +08:00
|
|
|
|
User.BindValueChanged(user =>
|
2023-01-11 15:47:29 +08:00
|
|
|
|
{
|
2023-01-11 15:48:47 +08:00
|
|
|
|
Clear(true);
|
|
|
|
|
|
|
|
|
|
if (user.NewValue != null)
|
|
|
|
|
AddRange(user.NewValue.Groups.Select(g => new GroupBadge(g)));
|
2023-01-11 15:47:29 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|