2019-10-09 19:10:05 +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.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osuTK;
|
|
|
|
|
using osu.Framework.Bindables;
|
2019-10-15 05:35:44 +08:00
|
|
|
|
using Humanizer;
|
2019-11-25 10:30:55 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-10-09 19:10:05 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Comments
|
|
|
|
|
{
|
2020-01-30 10:17:26 +08:00
|
|
|
|
public partial class DeletedCommentsCounter : CompositeDrawable
|
2019-10-09 19:10:05 +08:00
|
|
|
|
{
|
|
|
|
|
public readonly BindableBool ShowDeleted = new BindableBool();
|
2020-01-30 10:17:26 +08:00
|
|
|
|
|
|
|
|
|
public readonly BindableInt Count = new BindableInt();
|
2019-10-09 19:10:05 +08:00
|
|
|
|
|
2019-10-13 17:38:50 +08:00
|
|
|
|
private readonly SpriteText countText;
|
2019-10-09 19:10:05 +08:00
|
|
|
|
|
2020-01-30 10:17:26 +08:00
|
|
|
|
public DeletedCommentsCounter()
|
2019-10-13 17:38:50 +08:00
|
|
|
|
{
|
2019-10-09 19:10:05 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
2020-01-30 10:17:26 +08:00
|
|
|
|
InternalChild = new FillFlowContainer
|
2019-10-09 19:10:05 +08:00
|
|
|
|
{
|
2020-01-30 10:17:26 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Spacing = new Vector2(3, 0),
|
|
|
|
|
Children = new Drawable[]
|
2019-10-09 19:10:05 +08:00
|
|
|
|
{
|
2020-01-30 10:17:26 +08:00
|
|
|
|
new SpriteIcon
|
|
|
|
|
{
|
2021-03-23 10:32:17 +08:00
|
|
|
|
Icon = FontAwesome.Regular.TrashAlt,
|
2020-01-30 10:17:26 +08:00
|
|
|
|
Size = new Vector2(14),
|
|
|
|
|
},
|
|
|
|
|
countText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
|
|
|
|
|
}
|
2019-10-09 19:10:05 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
2020-01-30 10:17:26 +08:00
|
|
|
|
|
|
|
|
|
Count.BindValueChanged(_ => updateDisplay(), true);
|
|
|
|
|
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
|
2019-10-09 19:10:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-15 17:47:35 +08:00
|
|
|
|
private void updateDisplay()
|
2019-10-13 17:38:50 +08:00
|
|
|
|
{
|
2020-01-30 10:17:26 +08:00
|
|
|
|
if (!ShowDeleted.Value && Count.Value != 0)
|
2019-10-15 17:47:35 +08:00
|
|
|
|
{
|
2020-01-30 10:17:26 +08:00
|
|
|
|
countText.Text = @"deleted comment".ToQuantity(Count.Value);
|
|
|
|
|
Show();
|
2019-10-15 17:47:35 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-10-13 17:38:50 +08:00
|
|
|
|
Hide();
|
|
|
|
|
}
|
2019-10-09 19:10:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|