1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 21:33:22 +08:00

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;
FillFlowContainer leftIconArea = null!;
GridContainer titleContainer = null!;
FillFlowContainer titleBadgeArea = null!;
GridContainer artistContainer = null!;
Child = content.With(c =>
@ -93,7 +93,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
titleContainer = new GridContainer
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@ -108,7 +108,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
},
Content = new[]
{
new[]
new Drawable[]
{
new OsuSpriteText
{
@ -117,7 +117,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.X,
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)
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,
Origin = Anchor.BottomRight,
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)

View File

@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Height = height;
FillFlowContainer leftIconArea = null!;
GridContainer titleContainer = null!;
FillFlowContainer titleBadgeArea = null!;
GridContainer artistContainer = null!;
Child = content.With(c =>
@ -94,14 +94,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
titleContainer = new GridContainer
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
new Dimension(GridSizeMode.AutoSize),
},
RowDimensions = new[]
{
@ -109,7 +109,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
},
Content = new[]
{
new[]
new Drawable[]
{
new OsuSpriteText
{
@ -118,7 +118,13 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.X,
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)
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,
Origin = Anchor.BottomRight,
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)