mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Rename to BeatmapSetOverlay
This commit is contained in:
80
osu.Game/Overlays/BeatmapSet/FavouriteButton.cs
Normal file
80
osu.Game/Overlays/BeatmapSet/FavouriteButton.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public class FavouriteButton : HeaderButton
|
||||
{
|
||||
public readonly Bindable<bool> Favourited = new Bindable<bool>();
|
||||
|
||||
public FavouriteButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Container pink;
|
||||
SpriteIcon icon;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
pink = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"9f015f"),
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = OsuColour.FromHex(@"cb2187"),
|
||||
ColourDark = OsuColour.FromHex(@"9f015f"),
|
||||
TriangleScale = 1.5f,
|
||||
},
|
||||
},
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_heart_o,
|
||||
Size = new Vector2(18),
|
||||
Shadow = false,
|
||||
},
|
||||
};
|
||||
|
||||
Favourited.ValueChanged += value =>
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
pink.FadeIn(200);
|
||||
icon.Icon = FontAwesome.fa_heart;
|
||||
}
|
||||
else
|
||||
{
|
||||
pink.FadeOut(200);
|
||||
icon.Icon = FontAwesome.fa_heart_o;
|
||||
}
|
||||
};
|
||||
|
||||
Action = () => Favourited.Value = !Favourited.Value;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
Width = DrawHeight;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user