mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Tidy up all remaining usages
This commit is contained in:
@ -113,8 +113,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
Origin = Anchor.CentreLeft,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CalculatingDifficultyIcon(beatmapInfo, shouldShowTooltip: false)
|
||||
new CalculatingDifficultyIcon(beatmapInfo)
|
||||
{
|
||||
ShowTooltip = false,
|
||||
Scale = new Vector2(1.8f),
|
||||
},
|
||||
new FillFlowContainer
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Beatmaps.Drawables;
|
||||
|
||||
namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
public class FilterableDifficultyIcon : CalculatingDifficultyIcon
|
||||
public class FilterableDifficultyIcon : DifficultyIcon
|
||||
{
|
||||
private readonly BindableBool filtered = new BindableBool();
|
||||
|
||||
|
@ -8,23 +8,42 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
public class FilterableGroupedDifficultyIcon : GroupedDifficultyIcon
|
||||
/// <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>
|
||||
public class GroupedDifficultyIcon : DifficultyIcon
|
||||
{
|
||||
public readonly List<CarouselBeatmap> Items;
|
||||
|
||||
public FilterableGroupedDifficultyIcon(List<CarouselBeatmap> items, RulesetInfo ruleset)
|
||||
: base(items.Select(i => i.BeatmapInfo).ToList(), ruleset, Color4.White)
|
||||
public GroupedDifficultyIcon(List<CarouselBeatmap> items, RulesetInfo ruleset)
|
||||
: base(items.OrderBy(b => b.BeatmapInfo.StarRating).Last().BeatmapInfo, ruleset)
|
||||
{
|
||||
Items = items;
|
||||
|
||||
foreach (var item in items)
|
||||
item.Filtered.BindValueChanged(_ => Scheduler.AddOnce(updateFilteredDisplay));
|
||||
|
||||
AddInternal(new OsuSpriteText
|
||||
{
|
||||
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),
|
||||
Text = items.Count.ToString(),
|
||||
Colour = Color4.White,
|
||||
});
|
||||
|
||||
updateFilteredDisplay();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
||||
Status = beatmapSet.Status
|
||||
},
|
||||
new FillFlowContainer<CalculatingDifficultyIcon>
|
||||
new FillFlowContainer<DifficultyIcon>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(3),
|
||||
@ -87,13 +87,13 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private const int maximum_difficulty_icons = 18;
|
||||
|
||||
private IEnumerable<CalculatingDifficultyIcon> getDifficultyIcons()
|
||||
private IEnumerable<DifficultyIcon> getDifficultyIcons()
|
||||
{
|
||||
var beatmaps = carouselSet.Beatmaps.ToList();
|
||||
|
||||
return beatmaps.Count > maximum_difficulty_icons
|
||||
? (IEnumerable<CalculatingDifficultyIcon>)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset)
|
||||
.Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset))
|
||||
? (IEnumerable<DifficultyIcon>)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset)
|
||||
.Select(group => new GroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset))
|
||||
: beatmaps.Select(b => new FilterableDifficultyIcon(b));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user