// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Humanizer; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osuTK; namespace osu.Game.Overlays.Comments.Buttons { public class ShowRepliesButton : CommentRepliesButton { public readonly BindableBool Expanded = new BindableBool(true); private readonly int count; public ShowRepliesButton(int count) { this.count = count; } protected override void LoadComplete() { base.LoadComplete(); Expanded.BindValueChanged(onExpandedChanged, true); } private void onExpandedChanged(ValueChangedEvent expanded) { Icon.ScaleTo(new Vector2(1, expanded.NewValue ? -1 : 1)); } protected override bool OnClick(ClickEvent e) { Expanded.Toggle(); return base.OnClick(e); } protected override string GetText() => "reply".ToQuantity(count); } }