osu/osu.Game/Overlays/Comments/Buttons/ShowMoreRepliesButton.cs

50 lines
1.5 KiB
C#
Raw Normal View History

// 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;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using System.Collections.Generic;
using osuTK;
2020-07-27 21:43:06 +00:00
using osu.Framework.Allocation;
2020-07-27 21:43:06 +00:00
namespace osu.Game.Overlays.Comments.Buttons
{
public class ShowMoreRepliesButton : LoadingButton
{
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
private OsuSpriteText text;
public ShowMoreRepliesButton()
{
AutoSizeAxes = Axes.Both;
LoadingAnimationSize = new Vector2(8);
}
2020-07-27 21:43:06 +00:00
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Light2;
HoverColour = colourProvider.Light1;
}
protected override Drawable CreateContent() => new Container
{
AutoSizeAxes = Axes.Both,
Child = text = new OsuSpriteText
{
AlwaysPresent = true,
2020-07-27 21:43:06 +00:00
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = "show more"
}
};
2020-07-27 21:43:06 +00:00
protected override void OnLoadStarted() => text.FadeOut(200, Easing.OutQuint);
2020-07-27 21:43:06 +00:00
protected override void OnLoadFinished() => text.FadeIn(200, Easing.OutQuint);
}
}