mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 02:52:54 +08:00
Add play button for card preview
This commit is contained in:
parent
b44db9f5e5
commit
5d13686cdf
@ -17,6 +17,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
private readonly APIBeatmapSet beatmapSetInfo;
|
||||
|
||||
private readonly UpdateableOnlineBeatmapSetCover cover;
|
||||
private readonly PlayButton playButton;
|
||||
private readonly Container content;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
@ -32,6 +33,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
OnlineInfo = beatmapSetInfo
|
||||
},
|
||||
playButton = new PlayButton(),
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
@ -48,6 +50,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
playButton.FadeTo(Dimmed.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
cover.FadeColour(Dimmed.Value ? OsuColour.Gray(0.2f) : Color4.White, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
34
osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs
Normal file
34
osu.Game/Beatmaps/Drawables/Cards/Buttons/PlayButton.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
public class PlayButton : OsuHoverContainer
|
||||
{
|
||||
public PlayButton()
|
||||
{
|
||||
Anchor = Origin = Anchor.Centre;
|
||||
|
||||
Child = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.Solid.Play,
|
||||
Size = new Vector2(14)
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
HoverColour = colours.Yellow;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user