From 9b7c722d975624941be8c48d08dbe246dec5b1d1 Mon Sep 17 00:00:00 2001 From: StanR Date: Sun, 22 Jun 2025 01:24:58 +0500 Subject: [PATCH 1/3] Add beatmapset `This beatmap contains video` badge --- .../Online/TestSceneBeatmapSetOverlay.cs | 11 ++++ .../BeatmapSet/BeatmapSetHasVideoBadge.cs | 54 +++++++++++++++++++ .../BeatmapSet/BeatmapSetHeaderContent.cs | 33 ++++++++++-- 3 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 5dc6f950a5..4cb9ec4e88 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -243,6 +243,17 @@ namespace osu.Game.Tests.Visual.Online }); } + [Test] + public void TestBeatmapSetHasVideo() + { + AddStep("show beatmapset with video", () => + { + var beatmapSet = getBeatmapSet(); + beatmapSet.HasVideo = true; + overlay.ShowBeatmapSet(beatmapSet); + }); + } + [Test] public void TestSelectedModsDontAffectStatistics() { diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs new file mode 100644 index 0000000000..7281b3970c --- /dev/null +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs @@ -0,0 +1,54 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Overlays.BeatmapSet +{ + public partial class BeatmapSetHasVideoBadge : CircularContainer, IHasTooltip + { + public LocalisableString TooltipText => BeatmapsetsStrings.ShowInfoVideo; + + private readonly Box background; + + public BeatmapSetHasVideoBadge() + { + AutoSizeAxes = Axes.Both; + Masking = true; + Alpha = 0; + + Children = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f + }, + new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.Solid.Film, + Size = new Vector2(14), + Margin = new MarginPadding(10) + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + background.Colour = colourProvider.Background6; + } + } +} diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 9b10f6156d..7a48a02f58 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -46,6 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Box coverGradient; private readonly LinkFlowContainer title, artist; private readonly AuthorInfo author; + private readonly BeatmapSetHasVideoBadge beatmapSetVideoBadge; private ExternalLinkButton externalLink; @@ -175,13 +176,29 @@ namespace osu.Game.Overlays.BeatmapSet Spacing = new Vector2(10), Children = new Drawable[] { - onlineStatusPill = new BeatmapSetOnlineStatusPill + new FillFlowContainer { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - TextSize = 14, - TextPadding = new MarginPadding { Horizontal = 35, Vertical = 10 } + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10), + Children = new Drawable[] + { + onlineStatusPill = new BeatmapSetOnlineStatusPill + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + TextSize = 14, + TextPadding = new MarginPadding { Horizontal = 35, Vertical = 10 } + }, + beatmapSetVideoBadge = new BeatmapSetHasVideoBadge + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + } }, + Details = new Details(), }, }, @@ -218,6 +235,7 @@ namespace osu.Game.Overlays.BeatmapSet if (setInfo.NewValue == null) { onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint); + beatmapSetVideoBadge.Hide(); fadeContent.Hide(); loading.Show(); @@ -235,6 +253,11 @@ namespace osu.Game.Overlays.BeatmapSet loading.Hide(); + if (setInfo.NewValue.HasVideo) + beatmapSetVideoBadge.Show(); + else + beatmapSetVideoBadge.Hide(); + var titleText = new RomanisableString(setInfo.NewValue.TitleUnicode, setInfo.NewValue.Title); var artistText = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist); From 25eb9914a437dbb09a5b2246eb11b7f95ab56e87 Mon Sep 17 00:00:00 2001 From: StanR Date: Sun, 22 Jun 2025 13:45:07 +0500 Subject: [PATCH 2/3] Switch to IconPills, add storyboard icon --- .../Online/TestSceneBeatmapSetOverlay.cs | 15 +++++- osu.Game/Beatmaps/Drawables/Cards/IconPill.cs | 6 +++ .../BeatmapSet/BeatmapSetHasVideoBadge.cs | 54 ------------------- .../BeatmapSet/BeatmapSetHeaderContent.cs | 31 +++++++++-- 4 files changed, 46 insertions(+), 60 deletions(-) delete mode 100644 osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 4cb9ec4e88..f36ef7a8e8 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -244,7 +244,7 @@ namespace osu.Game.Tests.Visual.Online } [Test] - public void TestBeatmapSetHasVideo() + public void TestBeatmapSetHasVideoOrStoryboard() { AddStep("show beatmapset with video", () => { @@ -252,6 +252,19 @@ namespace osu.Game.Tests.Visual.Online beatmapSet.HasVideo = true; overlay.ShowBeatmapSet(beatmapSet); }); + AddStep("show beatmapset with storyboard", () => + { + var beatmapSet = getBeatmapSet(); + beatmapSet.HasStoryboard = true; + overlay.ShowBeatmapSet(beatmapSet); + }); + AddStep("show beatmapset with video and storyboard", () => + { + var beatmapSet = getBeatmapSet(); + beatmapSet.HasVideo = true; + beatmapSet.HasStoryboard = true; + overlay.ShowBeatmapSet(beatmapSet); + }); } [Test] diff --git a/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs b/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs index 16be57ac95..7cdd50e7ea 100644 --- a/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs +++ b/osu.Game/Beatmaps/Drawables/Cards/IconPill.cs @@ -20,6 +20,12 @@ namespace osu.Game.Beatmaps.Drawables.Cards set => iconContainer.Size = value; } + public MarginPadding IconPadding + { + get => iconContainer.Padding; + set => iconContainer.Padding = value; + } + private readonly Container iconContainer; protected IconPill(IconUsage icon) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs deleted file mode 100644 index 7281b3970c..0000000000 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHasVideoBadge.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Localisation; -using osu.Game.Resources.Localisation.Web; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Overlays.BeatmapSet -{ - public partial class BeatmapSetHasVideoBadge : CircularContainer, IHasTooltip - { - public LocalisableString TooltipText => BeatmapsetsStrings.ShowInfoVideo; - - private readonly Box background; - - public BeatmapSetHasVideoBadge() - { - AutoSizeAxes = Axes.Both; - Masking = true; - Alpha = 0; - - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0.5f - }, - new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Icon = FontAwesome.Solid.Film, - Size = new Vector2(14), - Margin = new MarginPadding(10) - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - background.Colour = colourProvider.Background6; - } - } -} diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 7a48a02f58..8cdb644cab 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Beatmaps.Drawables.Cards; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -46,7 +47,8 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Box coverGradient; private readonly LinkFlowContainer title, artist; private readonly AuthorInfo author; - private readonly BeatmapSetHasVideoBadge beatmapSetVideoBadge; + private readonly VideoIconPill videoIconPill; + private readonly StoryboardIconPill storyboardIconPill; private ExternalLinkButton externalLink; @@ -191,10 +193,23 @@ namespace osu.Game.Overlays.BeatmapSet TextSize = 14, TextPadding = new MarginPadding { Horizontal = 35, Vertical = 10 } }, - beatmapSetVideoBadge = new BeatmapSetHasVideoBadge + videoIconPill = new VideoIconPill { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + IconSize = new Vector2(34), + IconPadding = new MarginPadding(10), + }, + storyboardIconPill = new StoryboardIconPill + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + IconSize = new Vector2(34), + IconPadding = new MarginPadding(10), }, } }, @@ -235,7 +250,8 @@ namespace osu.Game.Overlays.BeatmapSet if (setInfo.NewValue == null) { onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint); - beatmapSetVideoBadge.Hide(); + videoIconPill.Hide(); + storyboardIconPill.Hide(); fadeContent.Hide(); loading.Show(); @@ -254,9 +270,14 @@ namespace osu.Game.Overlays.BeatmapSet loading.Hide(); if (setInfo.NewValue.HasVideo) - beatmapSetVideoBadge.Show(); + videoIconPill.Show(); else - beatmapSetVideoBadge.Hide(); + videoIconPill.Hide(); + + if (setInfo.NewValue.HasStoryboard) + storyboardIconPill.Show(); + else + storyboardIconPill.Hide(); var titleText = new RomanisableString(setInfo.NewValue.TitleUnicode, setInfo.NewValue.Title); var artistText = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist); From 5436313c86c2e36fc0d6ed8cdaebb26da8024407 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Mon, 23 Jun 2025 05:26:12 +0300 Subject: [PATCH 3/3] Flip storyboard/video icon order --- osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs index 8cdb644cab..f75e7b1d3c 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapSetHeaderContent.cs @@ -193,7 +193,7 @@ namespace osu.Game.Overlays.BeatmapSet TextSize = 14, TextPadding = new MarginPadding { Horizontal = 35, Vertical = 10 } }, - videoIconPill = new VideoIconPill + storyboardIconPill = new StoryboardIconPill { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, @@ -202,7 +202,7 @@ namespace osu.Game.Overlays.BeatmapSet IconSize = new Vector2(34), IconPadding = new MarginPadding(10), }, - storyboardIconPill = new StoryboardIconPill + videoIconPill = new VideoIconPill { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y,