Skip to content

Commit

Permalink
Integrate spotlight beatmap badge in listing cards
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed May 14, 2022
1 parent 2878a6d commit 9bac33e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
28 changes: 22 additions & 6 deletions osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void load(BeatmapSetOverlay? beatmapSetOverlay)
Height = height;

FillFlowContainer leftIconArea = null!;
GridContainer titleContainer = null!;
FillFlowContainer titleBadgeArea = null!;
GridContainer artistContainer = null!;

Child = content.With(c =>
Expand Down Expand Up @@ -93,7 +93,7 @@ private void load(BeatmapSetOverlay? beatmapSetOverlay)
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
titleContainer = new GridContainer
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Expand All @@ -108,7 +108,7 @@ private void load(BeatmapSetOverlay? beatmapSetOverlay)
},
Content = new[]
{
new[]
new Drawable[]
{
new OsuSpriteText
{
Expand All @@ -117,7 +117,13 @@ private void load(BeatmapSetOverlay? beatmapSetOverlay)
RelativeSizeAxes = Axes.X,
Truncate = true
},
Empty()
titleBadgeArea = new FillFlowContainer
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
}
}
}
},
Expand Down Expand Up @@ -244,14 +250,24 @@ private void load(BeatmapSetOverlay? beatmapSetOverlay)
if (BeatmapSet.HasStoryboard)
leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });

if (BeatmapSet.FeaturedInSpotlight)
{
titleBadgeArea.Add(new SpotlightBeatmapPill
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 }
});
}

if (BeatmapSet.HasExplicitContent)
{
titleContainer.Content[0][1] = new ExplicitContentBeatmapPill
titleBadgeArea.Add(new ExplicitContentBeatmapPill
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 }
};
});
}

if (BeatmapSet.TrackId != null)
Expand Down
30 changes: 23 additions & 7 deletions osu.Game/Beatmaps/Drawables/Cards/BeatmapCardNormal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void load()
Height = height;

FillFlowContainer leftIconArea = null!;
GridContainer titleContainer = null!;
FillFlowContainer titleBadgeArea = null!;
GridContainer artistContainer = null!;

Child = content.With(c =>
Expand Down Expand Up @@ -94,22 +94,22 @@ private void load()
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[]
{
new Dimension(GridSizeMode.AutoSize)
},
Content = new[]
{
new[]
new Drawable[]
{
new OsuSpriteText
{
Expand All @@ -118,7 +118,13 @@ private void load()
RelativeSizeAxes = Axes.X,
Truncate = true
},
Empty()
titleBadgeArea = new FillFlowContainer
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
}
}
}
},
Expand Down Expand Up @@ -225,14 +231,24 @@ private void load()
if (BeatmapSet.HasStoryboard)
leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });

if (BeatmapSet.FeaturedInSpotlight)
{
titleBadgeArea.Add(new SpotlightBeatmapPill
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 }
});
}

if (BeatmapSet.HasExplicitContent)
{
titleContainer.Content[0][1] = new ExplicitContentBeatmapPill
titleBadgeArea.Add(new ExplicitContentBeatmapPill
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 5 }
};
});
}

if (BeatmapSet.TrackId != null)
Expand Down

0 comments on commit 9bac33e

Please sign in to comment.