mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
ShowMoreButton rework
This commit is contained in:
50
osu.Game/Overlays/Comments/Buttons/ShowMoreButton.cs
Normal file
50
osu.Game/Overlays/Comments/Buttons/ShowMoreButton.cs
Normal file
@ -0,0 +1,50 @@
|
||||
// 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;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Overlays.Comments.Buttons
|
||||
{
|
||||
public class ShowMoreButton : LoadingButton
|
||||
{
|
||||
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
|
||||
|
||||
private OsuSpriteText text;
|
||||
|
||||
public ShowMoreButton()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Margin = new MarginPadding { Vertical = 10, Left = 80 };
|
||||
LoadingAnimationSize = new Vector2(8);
|
||||
}
|
||||
|
||||
[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,
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
||||
Text = "show more"
|
||||
}
|
||||
};
|
||||
|
||||
protected override void OnLoadStarted() => text.FadeOut(200, Easing.OutQuint);
|
||||
|
||||
protected override void OnLoadFinished() => text.FadeIn(200, Easing.OutQuint);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user