2019-04-26 12:29:58 +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 osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
2019-04-26 12:49:44 +08:00
|
|
|
namespace osu.Game.Overlays.Profile.Header.Components
|
2019-04-26 12:29:58 +08:00
|
|
|
{
|
2021-01-22 02:38:52 +08:00
|
|
|
public class AddFriendButton : ProfileHeaderStatisticsButton
|
2019-04-26 12:29:58 +08:00
|
|
|
{
|
|
|
|
public readonly Bindable<User> User = new Bindable<User>();
|
|
|
|
|
2021-01-22 02:26:33 +08:00
|
|
|
public override string TooltipText => "followers";
|
2019-04-26 12:29:58 +08:00
|
|
|
|
2021-01-22 02:38:52 +08:00
|
|
|
protected override IconUsage CreateIcon() => FontAwesome.Solid.User;
|
2019-04-26 12:29:58 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2020-12-17 18:33:49 +08:00
|
|
|
// todo: when friending/unfriending is implemented, the APIAccess.Friends list should be updated accordingly.
|
2019-04-26 12:29:58 +08:00
|
|
|
User.BindValueChanged(user => updateFollowers(user.NewValue), true);
|
|
|
|
}
|
|
|
|
|
2021-01-22 02:38:52 +08:00
|
|
|
private void updateFollowers(User user) => SetValue(user?.FollowerCount.ToString("#,##0"));
|
2019-04-26 12:29:58 +08:00
|
|
|
}
|
|
|
|
}
|