Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust beatmap card thumbnail dim state to match web better #24860

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{
public abstract partial class BeatmapCard : OsuClickableContainer, IHasContextMenu
{
public const float TRANSITION_DURATION = 400;
public const float TRANSITION_DURATION = 340;
public const float CORNER_RADIUS = 10;

protected const float WIDTH = 430;
Expand Down
19 changes: 13 additions & 6 deletions osu.Game/Beatmaps/Drawables/Cards/BeatmapCardThumbnail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.Drawables.Cards.Buttons;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Framework.Graphics.UserInterface;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Beatmaps.Drawables.Cards
{
Expand All @@ -25,23 +25,30 @@ public partial class BeatmapCardThumbnail : Container
set => foreground.Padding = value;
}

private readonly UpdateableOnlineBeatmapSetCover cover;
private readonly Box background;
private readonly Container foreground;
private readonly PlayButton playButton;
private readonly CircularProgress progress;
private readonly Container content;

protected override Container<Drawable> Content => content;

[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;

public BeatmapCardThumbnail(APIBeatmapSet beatmapSetInfo)
{
InternalChildren = new Drawable[]
{
cover = new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List)
new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List)
{
RelativeSizeAxes = Axes.Both,
OnlineInfo = beatmapSetInfo
},
background = new Box
{
RelativeSizeAxes = Axes.Both
},
foreground = new Container
{
RelativeSizeAxes = Axes.Both,
Expand All @@ -68,7 +75,7 @@ public BeatmapCardThumbnail(APIBeatmapSet beatmapSetInfo)
}

[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load()
{
progress.Colour = colourProvider.Highlight1;
}
Expand All @@ -89,7 +96,7 @@ private void updateState()
bool shouldDim = Dimmed.Value || playButton.Playing.Value;

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);
}
}
}