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