Restyle card buttons to resemble buttons more

This commit is contained in:
Bartłomiej Dach
2021-11-10 15:24:36 +01:00
parent 704ff47a0e
commit f090e5ca75
2 changed files with 44 additions and 10 deletions

View File

@ -0,0 +1,10 @@
// 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.
namespace osu.Game.Beatmaps.Drawables.Cards
{
public class BeatmapCardDownloadProgressBar
{
}
}

View File

@ -1,8 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -12,26 +16,45 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{ {
public abstract class BeatmapCardIconButton : OsuHoverContainer public abstract class BeatmapCardIconButton : OsuHoverContainer
{ {
protected override IEnumerable<Drawable> EffectTargets => background.Yield();
private readonly Box background;
protected readonly SpriteIcon Icon; protected readonly SpriteIcon Icon;
private float size; private float iconSize;
public new float Size public float IconSize
{ {
get => size; get => iconSize;
set set
{ {
size = value; iconSize = value;
Icon.Size = new Vector2(size); Icon.Size = new Vector2(iconSize);
} }
} }
protected BeatmapCardIconButton() protected BeatmapCardIconButton()
{ {
Add(Icon = new SpriteIcon()); Child = new CircularContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both
},
Icon = new SpriteIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
}
}
};
AutoSizeAxes = Axes.Both; Size = new Vector2(24);
Size = 12; IconSize = 12;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -39,8 +62,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{ {
Anchor = Origin = Anchor.Centre; Anchor = Origin = Anchor.Centre;
IdleColour = colourProvider.Light1; IdleColour = colourProvider.Background4;
HoverColour = colourProvider.Content1; HoverColour = colourProvider.Background1;
Icon.Colour = colourProvider.Content2;
} }
} }
} }