mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Merge pull request #18263 from frenzibyte/spotlight-beatmap-badge
Add support for "spotlight" label in beatmap overlay/listing
This commit is contained in:
commit
328561f5c8
@ -84,20 +84,26 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
explicitMap.Title = someDifficulties.TitleUnicode = "explicit beatmap";
|
explicitMap.Title = someDifficulties.TitleUnicode = "explicit beatmap";
|
||||||
explicitMap.HasExplicitContent = true;
|
explicitMap.HasExplicitContent = true;
|
||||||
|
|
||||||
|
var spotlightMap = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
|
spotlightMap.Title = someDifficulties.TitleUnicode = "spotlight beatmap";
|
||||||
|
spotlightMap.FeaturedInSpotlight = true;
|
||||||
|
|
||||||
var featuredMap = CreateAPIBeatmapSet(Ruleset.Value);
|
var featuredMap = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
featuredMap.Title = someDifficulties.TitleUnicode = "featured artist beatmap";
|
featuredMap.Title = someDifficulties.TitleUnicode = "featured artist beatmap";
|
||||||
featuredMap.TrackId = 1;
|
featuredMap.TrackId = 1;
|
||||||
|
|
||||||
var explicitFeaturedMap = CreateAPIBeatmapSet(Ruleset.Value);
|
var allBadgesMap = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
explicitFeaturedMap.Title = someDifficulties.TitleUnicode = "explicit featured artist";
|
allBadgesMap.Title = someDifficulties.TitleUnicode = "all-badges beatmap";
|
||||||
explicitFeaturedMap.HasExplicitContent = true;
|
allBadgesMap.HasExplicitContent = true;
|
||||||
explicitFeaturedMap.TrackId = 2;
|
allBadgesMap.FeaturedInSpotlight = true;
|
||||||
|
allBadgesMap.TrackId = 2;
|
||||||
|
|
||||||
var longName = CreateAPIBeatmapSet(Ruleset.Value);
|
var longName = CreateAPIBeatmapSet(Ruleset.Value);
|
||||||
longName.Title = longName.TitleUnicode = "this track has an incredibly and implausibly long title";
|
longName.Title = longName.TitleUnicode = "this track has an incredibly and implausibly long title";
|
||||||
longName.Artist = longName.ArtistUnicode = "and this artist! who would have thunk it. it's really such a long name.";
|
longName.Artist = longName.ArtistUnicode = "and this artist! who would have thunk it. it's really such a long name.";
|
||||||
longName.Source = "wow. even the source field has an impossibly long string in it. this really takes the cake, doesn't it?";
|
longName.Source = "wow. even the source field has an impossibly long string in it. this really takes the cake, doesn't it?";
|
||||||
longName.HasExplicitContent = true;
|
longName.HasExplicitContent = true;
|
||||||
|
longName.FeaturedInSpotlight = true;
|
||||||
longName.TrackId = 444;
|
longName.TrackId = 444;
|
||||||
|
|
||||||
testCases = new[]
|
testCases = new[]
|
||||||
@ -108,8 +114,9 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
someDifficulties,
|
someDifficulties,
|
||||||
manyDifficulties,
|
manyDifficulties,
|
||||||
explicitMap,
|
explicitMap,
|
||||||
|
spotlightMap,
|
||||||
featuredMap,
|
featuredMap,
|
||||||
explicitFeaturedMap,
|
allBadgesMap,
|
||||||
longName
|
longName
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,6 +165,17 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSpotlightBeatmap()
|
||||||
|
{
|
||||||
|
AddStep("show spotlight map", () =>
|
||||||
|
{
|
||||||
|
var beatmapSet = getBeatmapSet();
|
||||||
|
beatmapSet.FeaturedInSpotlight = true;
|
||||||
|
overlay.ShowBeatmapSet(beatmapSet);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFeaturedBeatmap()
|
public void TestFeaturedBeatmap()
|
||||||
{
|
{
|
||||||
@ -176,6 +187,19 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAllBadgesBeatmap()
|
||||||
|
{
|
||||||
|
AddStep("show map with all badges", () =>
|
||||||
|
{
|
||||||
|
var beatmapSet = getBeatmapSet();
|
||||||
|
beatmapSet.HasExplicitContent = true;
|
||||||
|
beatmapSet.FeaturedInSpotlight = true;
|
||||||
|
beatmapSet.TrackId = 1;
|
||||||
|
overlay.ShowBeatmapSet(beatmapSet);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHide()
|
public void TestHide()
|
||||||
{
|
{
|
||||||
|
@ -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,19 +250,29 @@ 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 SpotlightBeatmapBadge
|
||||||
{
|
{
|
||||||
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 ExplicitContentBeatmapBadge
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Margin = new MarginPadding { Left = 5 }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BeatmapSet.TrackId != null)
|
if (BeatmapSet.TrackId != null)
|
||||||
{
|
{
|
||||||
artistContainer.Content[0][1] = new FeaturedArtistBeatmapPill
|
artistContainer.Content[0][1] = new FeaturedArtistBeatmapBadge
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
|
@ -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,19 +231,29 @@ 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 SpotlightBeatmapBadge
|
||||||
{
|
{
|
||||||
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 ExplicitContentBeatmapBadge
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Margin = new MarginPadding { Left = 5 }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BeatmapSet.TrackId != null)
|
if (BeatmapSet.TrackId != null)
|
||||||
{
|
{
|
||||||
artistContainer.Content[0][1] = new FeaturedArtistBeatmapPill
|
artistContainer.Content[0][1] = new FeaturedArtistBeatmapBadge
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
|
@ -42,6 +42,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty(@"nsfw")]
|
[JsonProperty(@"nsfw")]
|
||||||
public bool HasExplicitContent { get; set; }
|
public bool HasExplicitContent { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"spotlight")]
|
||||||
|
public bool FeaturedInSpotlight { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"video")]
|
[JsonProperty(@"video")]
|
||||||
public bool HasVideo { get; set; }
|
public bool HasVideo { get; set; }
|
||||||
|
|
||||||
|
@ -6,42 +6,62 @@ using osu.Framework.Extensions.LocalisationExtensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
public class ExplicitContentBeatmapPill : CompositeDrawable
|
public abstract class BeatmapBadge : CompositeDrawable
|
||||||
{
|
{
|
||||||
public ExplicitContentBeatmapPill()
|
/// <summary>
|
||||||
|
/// The text displayed on the badge's label.
|
||||||
|
/// </summary>
|
||||||
|
public LocalisableString BadgeText
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
set => badgeLabel.Text = value.ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
/// <summary>
|
||||||
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
/// The colour of the badge's label.
|
||||||
|
/// </summary>
|
||||||
|
public Colour4 BadgeColour
|
||||||
{
|
{
|
||||||
|
set => badgeLabel.Colour = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly Box background;
|
||||||
|
private readonly OsuSpriteText badgeLabel;
|
||||||
|
|
||||||
|
protected BeatmapBadge()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
InternalChild = new CircularContainer
|
InternalChild = new CircularContainer
|
||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colourProvider?.Background5 ?? colours.Gray2,
|
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
badgeLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
|
|
||||||
Text = BeatmapsetsStrings.NsfwBadgeLabel.ToUpper(),
|
|
||||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
||||||
Colour = colours.Orange2
|
Margin = new MarginPadding { Horizontal = 10, Vertical = 2 },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
|
||||||
|
{
|
||||||
|
background.Colour = colourProvider?.Background5 ?? colours.Gray2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,8 +39,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly Box coverGradient;
|
private readonly Box coverGradient;
|
||||||
private readonly OsuSpriteText title, artist;
|
private readonly OsuSpriteText title, artist;
|
||||||
private readonly AuthorInfo author;
|
private readonly AuthorInfo author;
|
||||||
private readonly ExplicitContentBeatmapPill explicitContentPill;
|
|
||||||
private readonly FeaturedArtistBeatmapPill featuredArtistPill;
|
private readonly ExplicitContentBeatmapBadge explicitContent;
|
||||||
|
private readonly SpotlightBeatmapBadge spotlight;
|
||||||
|
private readonly FeaturedArtistBeatmapBadge featuredArtist;
|
||||||
|
|
||||||
private readonly FillFlowContainer downloadButtonsContainer;
|
private readonly FillFlowContainer downloadButtonsContainer;
|
||||||
private readonly BeatmapAvailability beatmapAvailability;
|
private readonly BeatmapAvailability beatmapAvailability;
|
||||||
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
||||||
@ -126,7 +129,14 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Margin = new MarginPadding { Left = 5, Bottom = 4 }, // To better lineup with the font
|
Margin = new MarginPadding { Left = 5, Bottom = 4 }, // To better lineup with the font
|
||||||
},
|
},
|
||||||
explicitContentPill = new ExplicitContentBeatmapPill
|
explicitContent = new ExplicitContentBeatmapBadge
|
||||||
|
{
|
||||||
|
Alpha = 0f,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Margin = new MarginPadding { Left = 10, Bottom = 4 },
|
||||||
|
},
|
||||||
|
spotlight = new SpotlightBeatmapBadge
|
||||||
{
|
{
|
||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
@ -146,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, italics: true),
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, italics: true),
|
||||||
},
|
},
|
||||||
featuredArtistPill = new FeaturedArtistBeatmapPill
|
featuredArtist = new FeaturedArtistBeatmapBadge
|
||||||
{
|
{
|
||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
@ -257,8 +267,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
title.Text = new RomanisableString(setInfo.NewValue.TitleUnicode, setInfo.NewValue.Title);
|
title.Text = new RomanisableString(setInfo.NewValue.TitleUnicode, setInfo.NewValue.Title);
|
||||||
artist.Text = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist);
|
artist.Text = new RomanisableString(setInfo.NewValue.ArtistUnicode, setInfo.NewValue.Artist);
|
||||||
|
|
||||||
explicitContentPill.Alpha = setInfo.NewValue.HasExplicitContent ? 1 : 0;
|
explicitContent.Alpha = setInfo.NewValue.HasExplicitContent ? 1 : 0;
|
||||||
featuredArtistPill.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0;
|
spotlight.Alpha = setInfo.NewValue.FeaturedInSpotlight ? 1 : 0;
|
||||||
|
featuredArtist.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0;
|
||||||
|
|
||||||
onlineStatusPill.FadeIn(500, Easing.OutQuint);
|
onlineStatusPill.FadeIn(500, Easing.OutQuint);
|
||||||
onlineStatusPill.Status = setInfo.NewValue.Status;
|
onlineStatusPill.Status = setInfo.NewValue.Status;
|
||||||
|
21
osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs
Normal file
21
osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapBadge.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
|
{
|
||||||
|
public class ExplicitContentBeatmapBadge : BeatmapBadge
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
BadgeText = BeatmapsetsStrings.NsfwBadgeLabel;
|
||||||
|
BadgeColour = colours.Orange2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs
Normal file
22
osu.Game/Overlays/BeatmapSet/FeaturedArtistBeatmapBadge.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
|
{
|
||||||
|
public class FeaturedArtistBeatmapBadge : BeatmapBadge
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
BadgeText = BeatmapsetsStrings.FeaturedArtistBadgeLabel;
|
||||||
|
BadgeColour = colours.Blue1;
|
||||||
|
// todo: add linking support to allow redirecting featured artist badge to corresponding track.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,47 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
|
||||||
{
|
|
||||||
public class FeaturedArtistBeatmapPill : CompositeDrawable
|
|
||||||
{
|
|
||||||
public FeaturedArtistBeatmapPill()
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
|
||||||
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
|
||||||
{
|
|
||||||
InternalChild = new CircularContainer
|
|
||||||
{
|
|
||||||
Masking = true,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colourProvider?.Background5 ?? colours.Gray2,
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
|
|
||||||
Text = BeatmapsetsStrings.FeaturedArtistBadgeLabel.ToUpper(),
|
|
||||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
|
||||||
Colour = colours.Blue1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
22
osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs
Normal file
22
osu.Game/Overlays/BeatmapSet/SpotlightBeatmapBadge.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
|
{
|
||||||
|
public class SpotlightBeatmapBadge : BeatmapBadge
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
BadgeText = BeatmapsetsStrings.SpotlightBadgeLabel;
|
||||||
|
BadgeColour = colours.Pink1;
|
||||||
|
// todo: add linking support to allow redirecting spotlight badge to https://osu.ppy.sh/wiki/en/Beatmap_Spotlights.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -78,7 +78,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private Container difficultyIconContainer;
|
private Container difficultyIconContainer;
|
||||||
private LinkFlowContainer beatmapText;
|
private LinkFlowContainer beatmapText;
|
||||||
private LinkFlowContainer authorText;
|
private LinkFlowContainer authorText;
|
||||||
private ExplicitContentBeatmapPill explicitContentPill;
|
private ExplicitContentBeatmapBadge explicitContent;
|
||||||
private ModDisplay modDisplay;
|
private ModDisplay modDisplay;
|
||||||
private FillFlowContainer buttonsFlow;
|
private FillFlowContainer buttonsFlow;
|
||||||
private UpdateableAvatar ownerAvatar;
|
private UpdateableAvatar ownerAvatar;
|
||||||
@ -293,7 +293,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool hasExplicitContent = (beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.HasExplicitContent == true;
|
bool hasExplicitContent = (beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.HasExplicitContent == true;
|
||||||
explicitContentPill.Alpha = hasExplicitContent ? 1 : 0;
|
explicitContent.Alpha = hasExplicitContent ? 1 : 0;
|
||||||
|
|
||||||
modDisplay.Current.Value = requiredMods.ToArray();
|
modDisplay.Current.Value = requiredMods.ToArray();
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both },
|
authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both },
|
||||||
explicitContentPill = new ExplicitContentBeatmapPill
|
explicitContent = new ExplicitContentBeatmapBadge
|
||||||
{
|
{
|
||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Loading…
Reference in New Issue
Block a user