Integrate spotlight beatmap badge in listing cards

This commit is contained in:
Salman Ahmed
2022-05-14 19:47:29 +03:00
parent 2878a6dcbe
commit 9bac33ec9f
2 changed files with 47 additions and 15 deletions

View File

@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Height = height; Height = height;
FillFlowContainer leftIconArea = null!; FillFlowContainer leftIconArea = null!;
GridContainer titleContainer = null!; FillFlowContainer titleBadgeArea = null!;
GridContainer artistContainer = null!; GridContainer artistContainer = null!;
Child = content.With(c => Child = content.With(c =>
@ -93,7 +93,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
titleContainer = new GridContainer new GridContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -108,7 +108,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
}, },
Content = new[] Content = new[]
{ {
new[] new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
{ {
@ -117,7 +117,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Truncate = true Truncate = true
}, },
Empty() titleBadgeArea = new FillFlowContainer
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
}
} }
} }
}, },
@ -244,14 +250,24 @@ namespace osu.Game.Beatmaps.Drawables.Cards
if (BeatmapSet.HasStoryboard) if (BeatmapSet.HasStoryboard)
leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });
if (BeatmapSet.HasExplicitContent) if (BeatmapSet.FeaturedInSpotlight)
{ {
titleContainer.Content[0][1] = new ExplicitContentBeatmapPill titleBadgeArea.Add(new SpotlightBeatmapPill
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 } Margin = new MarginPadding { Left = 5 }
}; });
}
if (BeatmapSet.HasExplicitContent)
{
titleBadgeArea.Add(new ExplicitContentBeatmapPill
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 }
});
} }
if (BeatmapSet.TrackId != null) if (BeatmapSet.TrackId != null)

View File

@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Height = height; Height = height;
FillFlowContainer leftIconArea = null!; FillFlowContainer leftIconArea = null!;
GridContainer titleContainer = null!; FillFlowContainer titleBadgeArea = null!;
GridContainer artistContainer = null!; GridContainer artistContainer = null!;
Child = content.With(c => Child = content.With(c =>
@ -94,14 +94,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
titleContainer = new GridContainer new GridContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
ColumnDimensions = new[] ColumnDimensions = new[]
{ {
new Dimension(), new Dimension(),
new Dimension(GridSizeMode.AutoSize) new Dimension(GridSizeMode.AutoSize),
}, },
RowDimensions = new[] RowDimensions = new[]
{ {
@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
}, },
Content = new[] Content = new[]
{ {
new[] new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
{ {
@ -118,7 +118,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Truncate = true Truncate = true
}, },
Empty() titleBadgeArea = new FillFlowContainer
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
}
} }
} }
}, },
@ -225,14 +231,24 @@ namespace osu.Game.Beatmaps.Drawables.Cards
if (BeatmapSet.HasStoryboard) if (BeatmapSet.HasStoryboard)
leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });
if (BeatmapSet.HasExplicitContent) if (BeatmapSet.FeaturedInSpotlight)
{ {
titleContainer.Content[0][1] = new ExplicitContentBeatmapPill titleBadgeArea.Add(new SpotlightBeatmapPill
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 } Margin = new MarginPadding { Left = 5 }
}; });
}
if (BeatmapSet.HasExplicitContent)
{
titleBadgeArea.Add(new ExplicitContentBeatmapPill
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 }
});
} }
if (BeatmapSet.TrackId != null) if (BeatmapSet.TrackId != null)