1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 21:03:08 +08:00

Add explicit pill to beatmap panels

This commit is contained in:
Salman Ahmed 2021-01-13 11:29:30 +03:00
parent ee6baeb57e
commit f6637eec36
2 changed files with 47 additions and 9 deletions

View File

@ -14,6 +14,7 @@ using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.BeatmapSet;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -24,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
private const float horizontal_padding = 10; private const float horizontal_padding = 10;
private const float vertical_padding = 5; private const float vertical_padding = 5;
private FillFlowContainer bottomPanel, statusContainer; private FillFlowContainer bottomPanel, statusContainer, titleContainer;
private PlayButton playButton; private PlayButton playButton;
private Box progressBar; private Box progressBar;
@ -73,12 +74,20 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = horizontal_padding, Right = horizontal_padding }, Padding = new MarginPadding { Left = horizontal_padding, Right = horizontal_padding },
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new[] Children = new Drawable[]
{ {
new OsuSpriteText titleContainer = new FillFlowContainer
{ {
Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), AutoSizeAxes = Axes.Both,
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true) Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
new OsuSpriteText
{
Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)),
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
},
}
}, },
new OsuSpriteText new OsuSpriteText
{ {
@ -194,6 +203,16 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
}, },
}); });
if (SetInfo.OnlineInfo?.HasExplicitContent ?? false)
{
titleContainer.Add(new ExplicitBeatmapPill
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Left = 10f, Top = 2f },
});
}
if (SetInfo.OnlineInfo?.HasVideo ?? false) if (SetInfo.OnlineInfo?.HasVideo ?? false)
{ {
statusContainer.Add(new IconPill(FontAwesome.Solid.Film)); statusContainer.Add(new IconPill(FontAwesome.Solid.Film));

View File

@ -14,6 +14,7 @@ using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.BeatmapSet;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -26,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
private const float vertical_padding = 5; private const float vertical_padding = 5;
private const float height = 70; private const float height = 70;
private FillFlowContainer statusContainer; private FillFlowContainer statusContainer, titleContainer;
protected BeatmapPanelDownloadButton DownloadButton; protected BeatmapPanelDownloadButton DownloadButton;
private PlayButton playButton; private PlayButton playButton;
private Box progressBar; private Box progressBar;
@ -98,10 +99,18 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText titleContainer = new FillFlowContainer
{ {
Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), AutoSizeAxes = Axes.Both,
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true) Direction = FillDirection.Horizontal,
Children = new[]
{
new OsuSpriteText
{
Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)),
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
},
}
}, },
new OsuSpriteText new OsuSpriteText
{ {
@ -208,6 +217,16 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
}, },
}); });
if (SetInfo.OnlineInfo?.HasExplicitContent ?? false)
{
titleContainer.Add(new ExplicitBeatmapPill
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Left = 10f, Top = 2f },
});
}
if (SetInfo.OnlineInfo?.HasVideo ?? false) if (SetInfo.OnlineInfo?.HasVideo ?? false)
{ {
statusContainer.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) }); statusContainer.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) });