From f090e5ca7525edf51328dd892822941027ffd64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= <dach.bartlomiej@gmail.com> Date: Wed, 10 Nov 2021 15:24:36 +0100 Subject: [PATCH] Restyle card buttons to resemble buttons more --- .../Cards/BeatmapCardDownloadProgressBar.cs | 10 +++++ .../Cards/Buttons/BeatmapCardIconButton.cs | 44 ++++++++++++++----- 2 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs diff --git a/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs new file mode 100644 index 0000000000..56e23f920b --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/Cards/BeatmapCardDownloadProgressBar.cs @@ -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 + { + + } +} diff --git a/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs b/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs index 155259d859..ebd78938c7 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/Buttons/BeatmapCardIconButton.cs @@ -1,8 +1,12 @@ // 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 System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Containers; using osu.Game.Overlays; @@ -12,26 +16,45 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons { public abstract class BeatmapCardIconButton : OsuHoverContainer { + protected override IEnumerable<Drawable> EffectTargets => background.Yield(); + + private readonly Box background; protected readonly SpriteIcon Icon; - private float size; + private float iconSize; - public new float Size + public float IconSize { - get => size; + get => iconSize; set { - size = value; - Icon.Size = new Vector2(size); + iconSize = value; + Icon.Size = new Vector2(iconSize); } } 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 = 12; + Size = new Vector2(24); + IconSize = 12; } [BackgroundDependencyLoader] @@ -39,8 +62,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons { Anchor = Origin = Anchor.Centre; - IdleColour = colourProvider.Light1; - HoverColour = colourProvider.Content1; + IdleColour = colourProvider.Background4; + HoverColour = colourProvider.Background1; + Icon.Colour = colourProvider.Content2; } } }