1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-05 04:52:53 +08:00

Adjust beatmap card thumbnail dim state to match web better

This commit is contained in:
Bartłomiej Dach 2023-09-19 10:27:24 +02:00
parent c0f603eb0e
commit 62f97a8d83
No known key found for this signature in database

View File

@ -3,15 +3,15 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.Drawables.Cards.Buttons; using osu.Game.Beatmaps.Drawables.Cards.Buttons;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables.Cards namespace osu.Game.Beatmaps.Drawables.Cards
{ {
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
set => foreground.Padding = value; set => foreground.Padding = value;
} }
private readonly UpdateableOnlineBeatmapSetCover cover; private readonly Box background;
private readonly Container foreground; private readonly Container foreground;
private readonly PlayButton playButton; private readonly PlayButton playButton;
private readonly CircularProgress progress; private readonly CircularProgress progress;
@ -33,15 +33,22 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public BeatmapCardThumbnail(APIBeatmapSet beatmapSetInfo) public BeatmapCardThumbnail(APIBeatmapSet beatmapSetInfo)
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
cover = new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List) new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
OnlineInfo = beatmapSetInfo OnlineInfo = beatmapSetInfo
}, },
background = new Box
{
RelativeSizeAxes = Axes.Both
},
foreground = new Container foreground = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -68,7 +75,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider) private void load()
{ {
progress.Colour = colourProvider.Highlight1; progress.Colour = colourProvider.Highlight1;
} }
@ -89,7 +96,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
bool shouldDim = Dimmed.Value || playButton.Playing.Value; bool shouldDim = Dimmed.Value || playButton.Playing.Value;
playButton.FadeTo(shouldDim ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint); playButton.FadeTo(shouldDim ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
cover.FadeColour(shouldDim ? OsuColour.Gray(0.2f) : Color4.White, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint); background.FadeColour(colourProvider.Background6.Opacity(shouldDim ? 0.8f : 0f), BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }