2019-01-24 17:43:03 +09: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.
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-02-21 19:04:31 +09:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-11-18 18:19:35 +03:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-10-02 12:02:47 +09:00
|
|
|
|
using osu.Framework.Input.Events;
|
2017-11-18 18:19:35 +03:00
|
|
|
|
using osu.Game.Graphics;
|
2017-12-26 00:44:35 +09:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2017-11-18 18:19:35 +03:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-08-29 15:00:28 +03:00
|
|
|
|
using osu.Framework.Extensions.LocalisationExtensions;
|
2021-07-17 16:29:09 +02:00
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
|
|
|
|
using osu.Framework.Localisation;
|
2023-01-14 19:23:25 -08:00
|
|
|
|
using osu.Game.Online.Chat;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-11-18 18:19:35 +03:00
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|
|
|
|
{
|
|
|
|
|
public partial class KudosuInfo : Container
|
|
|
|
|
{
|
2023-01-10 19:24:54 +01:00
|
|
|
|
private readonly Bindable<UserProfileData?> user = new Bindable<UserProfileData?>();
|
2019-05-29 21:19:03 +03:00
|
|
|
|
|
2023-01-10 19:24:54 +01:00
|
|
|
|
public KudosuInfo(Bindable<UserProfileData?> user)
|
2017-11-18 18:19:35 +03:00
|
|
|
|
{
|
2023-01-10 19:24:54 +01:00
|
|
|
|
this.user.BindTo(user);
|
2017-11-23 17:29:20 +09:00
|
|
|
|
CountSection total;
|
2017-11-18 18:19:35 +03:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2017-11-18 18:41:00 +03:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2017-11-18 18:19:35 +03:00
|
|
|
|
Masking = true;
|
|
|
|
|
CornerRadius = 3;
|
2021-03-17 13:13:13 -07:00
|
|
|
|
Child = total = new CountTotal();
|
|
|
|
|
|
2023-01-10 19:24:54 +01:00
|
|
|
|
this.user.ValueChanged += u => total.Count = u.NewValue?.User.Kudosu.Total ?? 0;
|
2017-11-18 18:19:35 +03:00
|
|
|
|
}
|
2019-05-29 21:19:03 +03:00
|
|
|
|
|
2018-10-02 12:02:47 +09:00
|
|
|
|
protected override bool OnClick(ClickEvent e) => true;
|
2019-05-29 21:19:03 +03:00
|
|
|
|
|
2019-05-30 16:57:54 +09:00
|
|
|
|
private partial class CountTotal : CountSection
|
|
|
|
|
{
|
|
|
|
|
public CountTotal()
|
2021-07-17 16:29:09 +02:00
|
|
|
|
: base(UsersStrings.ShowExtraKudosuTotal)
|
2019-05-30 16:57:54 +09:00
|
|
|
|
{
|
|
|
|
|
DescriptionText.AddText("Based on how much of a contribution the user has made to beatmap moderation. See ");
|
2023-01-14 19:23:25 -08:00
|
|
|
|
DescriptionText.AddLink("this page", LinkAction.OpenWiki, @"Modding/Kudosu");
|
2019-05-30 16:57:54 +09:00
|
|
|
|
DescriptionText.AddText(" for more information.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-23 17:29:20 +09:00
|
|
|
|
private partial class CountSection : Container
|
2017-11-18 18:19:35 +03:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText valueText;
|
2019-05-30 16:57:54 +09:00
|
|
|
|
protected readonly LinkFlowContainer DescriptionText;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-11-30 00:11:00 +09:00
|
|
|
|
public new int Count
|
2017-11-18 18:19:35 +03:00
|
|
|
|
{
|
2021-07-24 10:16:47 +02:00
|
|
|
|
set => valueText.Text = value.ToLocalisableString("N0");
|
2017-11-18 18:19:35 +03:00
|
|
|
|
}
|
2019-05-29 21:19:03 +03:00
|
|
|
|
|
2023-04-02 21:05:20 +09:00
|
|
|
|
protected CountSection(LocalisableString header)
|
2017-11-18 18:19:35 +03:00
|
|
|
|
{
|
2017-11-18 18:41:00 +03:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2023-03-12 18:46:34 -07:00
|
|
|
|
Padding = new MarginPadding { Bottom = 20 };
|
2017-11-18 18:19:35 +03:00
|
|
|
|
Child = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-29 21:02:20 +03:00
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = header,
|
2019-05-30 16:49:18 +09:00
|
|
|
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold)
|
2019-05-29 21:02:20 +03:00
|
|
|
|
},
|
|
|
|
|
valueText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "0",
|
2019-05-30 16:49:18 +09:00
|
|
|
|
Font = OsuFont.GetFont(size: 40, weight: FontWeight.Light),
|
2019-05-29 21:02:20 +03:00
|
|
|
|
},
|
2019-05-30 16:57:54 +09:00
|
|
|
|
DescriptionText = new LinkFlowContainer(t => t.Font = t.Font.With(size: 14))
|
2017-11-18 18:19:35 +03:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|