1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +08:00

Revert ExplicitContentBeatmapPill, don't try to reuse common code

This commit is contained in:
ekrctb 2021-09-09 19:25:30 +09:00
parent 52bb02baed
commit 29f947fa07
3 changed files with 46 additions and 55 deletions

View File

@ -1,45 +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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
public class BeatmapSetBadgePillContainer : CircularContainer
{
protected override Container<Drawable> Content => contentContainer;
private readonly Box background;
private readonly Container contentContainer;
public BeatmapSetBadgePillContainer()
{
Masking = true;
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
contentContainer = new Container
{
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 10f, Vertical = 2f },
}
};
}
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] OsuColour colours, [CanBeNull] OverlayColourProvider colourProvider)
{
background.Colour = colourProvider?.Background5 ?? colours?.Gray2 ?? Color4.DarkGray;
}
}
}

View File

@ -1,9 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions; 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.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
@ -15,13 +17,29 @@ namespace osu.Game.Overlays.BeatmapSet
public ExplicitContentBeatmapPill() public ExplicitContentBeatmapPill()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
InternalChild = new BeatmapSetBadgePillContainer }
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
InternalChild = new CircularContainer
{ {
Child = new OsuSpriteText Masking = true,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
Text = BeatmapsetsStrings.NsfwBadgeLabel.ToUpper(), new Box
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), {
Colour = OverlayColourProvider.Orange.Colour2, RelativeSizeAxes = Axes.Both,
Colour = colourProvider?.Background5 ?? colours.Gray2,
},
new OsuSpriteText
{
Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
Text = BeatmapsetsStrings.NsfwBadgeLabel.ToUpper(),
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
Colour = OverlayColourProvider.Orange.Colour2,
}
} }
}; };
} }

View File

@ -1,9 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions; 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.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
@ -15,13 +17,29 @@ namespace osu.Game.Overlays.BeatmapSet
public FeaturedArtistBeatmapPill() public FeaturedArtistBeatmapPill()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
InternalChild = new BeatmapSetBadgePillContainer }
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
InternalChild = new CircularContainer
{ {
Child = new OsuSpriteText Masking = true,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
Text = BeatmapsetsStrings.FeaturedArtistBadgeLabel.ToUpper(), new Box
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), {
Colour = OverlayColourProvider.Blue.Colour1 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 = OverlayColourProvider.Blue.Colour1,
}
} }
}; };
} }