1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 11:32:54 +08:00

Merge pull request #28947 from peppy/fix-playlist-item-panel

Fix various visuals of playlist beatmap panels
This commit is contained in:
Dan Balasescu 2024-07-19 20:12:40 +09:00 committed by GitHub
commit ad564f31cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 130 additions and 106 deletions

View File

@ -101,7 +101,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);
background.FadeColour(colourProvider.Background6.Opacity(shouldDim ? 0.8f : 0f), BeatmapCard.TRANSITION_DURATION, Easing.OutQuint); background.FadeColour(colourProvider.Background6.Opacity(shouldDim ? 0.6f : 0f), BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }

View File

@ -49,6 +49,8 @@ namespace osu.Game.Screens.OnlinePlay
private const float icon_height = 34; private const float icon_height = 34;
private const float border_thickness = 3;
/// <summary> /// <summary>
/// Invoked when this item requests to be deleted. /// Invoked when this item requests to be deleted.
/// </summary> /// </summary>
@ -81,7 +83,7 @@ namespace osu.Game.Screens.OnlinePlay
private IRulesetInfo ruleset; private IRulesetInfo ruleset;
private Mod[] requiredMods = Array.Empty<Mod>(); private Mod[] requiredMods = Array.Empty<Mod>();
private Container maskingContainer; private Container borderContainer;
private FillFlowContainer difficultyIconContainer; private FillFlowContainer difficultyIconContainer;
private LinkFlowContainer beatmapText; private LinkFlowContainer beatmapText;
private LinkFlowContainer authorText; private LinkFlowContainer authorText;
@ -134,7 +136,7 @@ namespace osu.Game.Screens.OnlinePlay
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
maskingContainer.BorderColour = colours.Yellow; borderContainer.BorderColour = colours.Yellow;
ruleset = rulesets.GetRuleset(Item.RulesetID); ruleset = rulesets.GetRuleset(Item.RulesetID);
var rulesetInstance = ruleset?.CreateInstance(); var rulesetInstance = ruleset?.CreateInstance();
@ -161,7 +163,7 @@ namespace osu.Game.Screens.OnlinePlay
return; return;
} }
maskingContainer.BorderThickness = IsSelectedItem ? 5 : 0; borderContainer.BorderThickness = IsSelectedItem ? border_thickness : 0;
}, true); }, true);
valid.BindValueChanged(_ => Scheduler.AddOnce(refresh)); valid.BindValueChanged(_ => Scheduler.AddOnce(refresh));
@ -278,8 +280,8 @@ namespace osu.Game.Screens.OnlinePlay
{ {
if (!valid.Value) if (!valid.Value)
{ {
maskingContainer.BorderThickness = 5; borderContainer.BorderThickness = border_thickness;
maskingContainer.BorderColour = colours.Red; borderContainer.BorderColour = colours.Red;
} }
if (beatmap != null) if (beatmap != null)
@ -291,12 +293,14 @@ namespace osu.Game.Screens.OnlinePlay
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Width = 60, Width = 60,
Masking = true,
CornerRadius = 10,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Dimmed = { Value = IsHovered } Dimmed = { Value = IsHovered }
}, },
new DifficultyIcon(beatmap, ruleset, requiredMods) new DifficultyIcon(beatmap, ruleset, requiredMods)
{ {
Size = new Vector2(icon_height), Size = new Vector2(24),
TooltipType = DifficultyIconTooltipType.Extended, TooltipType = DifficultyIconTooltipType.Extended,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -346,20 +350,19 @@ namespace osu.Game.Screens.OnlinePlay
{ {
Action<SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(size: 14, weight: FontWeight.SemiBold); Action<SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(size: 14, weight: FontWeight.SemiBold);
return maskingContainer = new Container return new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = HEIGHT, Height = HEIGHT,
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true, Masking = true,
CornerRadius = 10, CornerRadius = 10,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box // A transparent box that forces the border to be drawn if the panel background is opaque
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
},
onScreenLoader, onScreenLoader,
panelBackground = new PanelBackground panelBackground = new PanelBackground
{ {
@ -396,6 +399,7 @@ namespace osu.Game.Screens.OnlinePlay
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, -2),
Children = new Drawable[] Children = new Drawable[]
{ {
beatmapText = new LinkFlowContainer(fontParameters) beatmapText = new LinkFlowContainer(fontParameters)
@ -476,6 +480,23 @@ namespace osu.Game.Screens.OnlinePlay
} }
}, },
}, },
},
borderContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box // A transparent box that forces the border to be drawn if the panel background is opaque
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
},
}
}
}
}; };
} }
@ -509,6 +530,8 @@ namespace osu.Game.Screens.OnlinePlay
{ {
if (thumbnail != null) if (thumbnail != null)
thumbnail.Dimmed.Value = true; thumbnail.Dimmed.Value = true;
panelBackground.FadeColour(OsuColour.Gray(0.7f), BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
return base.OnHover(e); return base.OnHover(e);
} }
@ -516,6 +539,8 @@ namespace osu.Game.Screens.OnlinePlay
{ {
if (thumbnail != null) if (thumbnail != null)
thumbnail.Dimmed.Value = false; thumbnail.Dimmed.Value = false;
panelBackground.FadeColour(OsuColour.Gray(1f), BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
base.OnHoverLost(e); base.OnHoverLost(e);
} }
@ -642,7 +667,6 @@ namespace osu.Game.Screens.OnlinePlay
backgroundSprite = new UpdateableBeatmapBackgroundSprite backgroundSprite = new UpdateableBeatmapBackgroundSprite
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -651,7 +675,7 @@ namespace osu.Game.Screens.OnlinePlay
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
Shear = new Vector2(0.8f, 0), Shear = new Vector2(0.8f, 0),
Alpha = 0.5f, Alpha = 0.6f,
Children = new[] Children = new[]
{ {
// The left half with no gradient applied // The left half with no gradient applied