mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 17:13:06 +08:00
Make Icon rotate when clicking ShowRepliesButton
This commit is contained in:
parent
da249abd19
commit
0861ee0c8e
@ -2,11 +2,17 @@
|
||||
// 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)
|
||||
@ -14,6 +20,23 @@ namespace osu.Game.Overlays.Comments.Buttons
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Expanded.BindValueChanged(onExpandedChanged, true);
|
||||
}
|
||||
|
||||
private void onExpandedChanged(ValueChangedEvent<bool> 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user