mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Add play button for card preview
This commit is contained in:
@ -17,6 +17,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
private readonly APIBeatmapSet beatmapSetInfo;
|
private readonly APIBeatmapSet beatmapSetInfo;
|
||||||
|
|
||||||
private readonly UpdateableOnlineBeatmapSetCover cover;
|
private readonly UpdateableOnlineBeatmapSetCover cover;
|
||||||
|
private readonly PlayButton playButton;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
@ -32,6 +33,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnlineInfo = beatmapSetInfo
|
OnlineInfo = beatmapSetInfo
|
||||||
},
|
},
|
||||||
|
playButton = new PlayButton(),
|
||||||
content = new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
@ -48,6 +50,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
|
|
||||||
private void updateState()
|
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);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user