mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 05:17:29 +08:00
da29947ecd
I kinda liked this flow, but from multiple reports from users it definitely seems in the way. We can revisit after the new design is applied to song select. Note that this means the tooltips also don't display. If it is preferred that they should (arguable from a UX perspective, since I'd expect to be able to click at that point) then the issue can be addressed using a slightly different path (a few more lines - nothing too complex).
99 lines
4.1 KiB
C#
99 lines
4.1 KiB
C#
// 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 System.Collections.Generic;
|
|
using System.Linq;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Localisation;
|
|
using osu.Game.Beatmaps.Drawables;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Graphics.Sprites;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Screens.Select.Carousel
|
|
{
|
|
public class SetPanelContent : CompositeDrawable
|
|
{
|
|
// Disallow interacting with difficulty icons on a panel until the panel has been selected.
|
|
public override bool PropagatePositionalInputSubTree => carouselSet.State.Value == CarouselItemState.Selected;
|
|
|
|
private readonly CarouselBeatmapSet carouselSet;
|
|
|
|
public SetPanelContent(CarouselBeatmapSet carouselSet)
|
|
{
|
|
this.carouselSet = carouselSet;
|
|
|
|
// required to ensure we load as soon as any part of the panel comes on screen
|
|
RelativeSizeAxes = Axes.Both;
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
var beatmapSet = carouselSet.BeatmapSet;
|
|
|
|
InternalChild = new FillFlowContainer
|
|
{
|
|
// required to ensure we load as soon as any part of the panel comes on screen
|
|
RelativeSizeAxes = Axes.Both,
|
|
Direction = FillDirection.Vertical,
|
|
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
|
|
Children = new Drawable[]
|
|
{
|
|
new OsuSpriteText
|
|
{
|
|
Text = new RomanisableString(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title),
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22, italics: true),
|
|
Shadow = true,
|
|
},
|
|
new OsuSpriteText
|
|
{
|
|
Text = new RomanisableString(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist),
|
|
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 17, italics: true),
|
|
Shadow = true,
|
|
},
|
|
new FillFlowContainer
|
|
{
|
|
Direction = FillDirection.Horizontal,
|
|
AutoSizeAxes = Axes.Both,
|
|
Margin = new MarginPadding { Top = 5 },
|
|
Children = new Drawable[]
|
|
{
|
|
new BeatmapSetOnlineStatusPill
|
|
{
|
|
AutoSizeAxes = Axes.Both,
|
|
Origin = Anchor.CentreLeft,
|
|
Anchor = Anchor.CentreLeft,
|
|
Margin = new MarginPadding { Right = 5 },
|
|
TextSize = 11,
|
|
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
|
Status = beatmapSet.Status
|
|
},
|
|
new FillFlowContainer<DifficultyIcon>
|
|
{
|
|
AutoSizeAxes = Axes.Both,
|
|
Spacing = new Vector2(3),
|
|
ChildrenEnumerable = getDifficultyIcons(),
|
|
},
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
private const int maximum_difficulty_icons = 18;
|
|
|
|
private IEnumerable<DifficultyIcon> getDifficultyIcons()
|
|
{
|
|
var beatmaps = carouselSet.Beatmaps.ToList();
|
|
|
|
return beatmaps.Count > maximum_difficulty_icons
|
|
? (IEnumerable<DifficultyIcon>)beatmaps.GroupBy(b => b.BeatmapInfo.Ruleset)
|
|
.Select(group => new FilterableGroupedDifficultyIcon(group.ToList(), group.Last().BeatmapInfo.Ruleset))
|
|
: beatmaps.Select(b => new FilterableDifficultyIcon(b));
|
|
}
|
|
}
|
|
}
|