2019-08-24 04:36:23 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2019-08-24 04:36:23 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables
|
|
|
|
{
|
2019-08-24 14:43:55 +08:00
|
|
|
/// <summary>
|
|
|
|
/// A difficulty icon that contains a counter on the right-side of it.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Used in cases when there are too many difficulty icons to show.
|
|
|
|
/// </remarks>
|
2022-06-23 17:37:53 +08:00
|
|
|
public class GroupedDifficultyIcon : CalculatingDifficultyIcon
|
2019-08-24 04:36:23 +08:00
|
|
|
{
|
2021-10-29 16:03:50 +08:00
|
|
|
public GroupedDifficultyIcon(IEnumerable<IBeatmapInfo> beatmaps, IRulesetInfo ruleset, Color4 counterColour)
|
|
|
|
: base(beatmaps.OrderBy(b => b.StarRating).Last(), ruleset, null, false)
|
2019-08-24 04:36:23 +08:00
|
|
|
{
|
2019-08-25 10:38:26 +08:00
|
|
|
AddInternal(new OsuSpriteText
|
2019-08-24 04:36:23 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
Padding = new MarginPadding { Left = Size.X },
|
|
|
|
Margin = new MarginPadding { Left = 2, Right = 5 },
|
|
|
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
|
2021-10-29 16:03:50 +08:00
|
|
|
Text = beatmaps.Count().ToString(),
|
2019-08-24 04:36:23 +08:00
|
|
|
Colour = counterColour,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|