diff --git a/osu.Game/Screens/SelectV2/PanelGroupStarDifficulty.cs b/osu.Game/Screens/SelectV2/PanelGroupStarDifficulty.cs index 4ef3bd724c..8e64b89aae 100644 --- a/osu.Game/Screens/SelectV2/PanelGroupStarDifficulty.cs +++ b/osu.Game/Screens/SelectV2/PanelGroupStarDifficulty.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -29,6 +30,8 @@ namespace osu.Game.Screens.SelectV2 private Drawable iconContainer = null!; private Box contentBackground = null!; private OsuSpriteText starRatingText = null!; + private CircularContainer countPill = null!; + private OsuSpriteText countText = null!; private TrianglesV2 triangles = null!; private Box glow = null!; @@ -92,12 +95,12 @@ namespace osu.Game.Screens.SelectV2 } } }, - new CircularContainer + countPill = new CircularContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Size = new Vector2(50f, 14f), - Margin = new MarginPadding { Right = 20f }, + Margin = new MarginPadding { Right = 30f }, Masking = true, Children = new Drawable[] { @@ -106,13 +109,11 @@ namespace osu.Game.Screens.SelectV2 RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(0.7f), }, - new OsuSpriteText + countText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.Style.Caption1.With(weight: FontWeight.Bold), - // TODO: requires Carousel/CarouselItem-side implementation - Text = "43", UseFullGlyphHeight = false, } }, @@ -170,6 +171,8 @@ namespace osu.Game.Screens.SelectV2 triangles.Colour = colour; + countText.Text = Item.NestedItemCount.ToLocalisableString(@"N0"); + onExpanded(); } @@ -182,5 +185,13 @@ namespace osu.Game.Screens.SelectV2 glow.FadeTo(Expanded.Value ? 0.4f : 0, duration, Easing.OutQuint); } + + protected override void Update() + { + base.Update(); + + // Move the count pill in the opposite direction to keep it pinned to the screen regardless of the X position of TopLevelContent. + countPill.X = -TopLevelContent.X; + } } }