1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Fix potentially missing group headers in beatmap carousel

This commit is contained in:
Dean Herbert 2018-04-24 01:52:25 +09:00
parent f4c2d6b1a3
commit 3886e75959
2 changed files with 11 additions and 3 deletions

View File

@ -27,6 +27,11 @@ namespace osu.Game.Screens.Select.Carousel
get
{
var drawables = base.Drawables;
// if we are explicitly not present, don't ever present children.
// without this check, children drawables can potentially be presented without their group header.
if (DrawableRepresentation.Value?.IsPresent == false) return drawables;
foreach (var c in InternalChildren)
drawables.AddRange(c.Drawables);
return drawables;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Select.Carousel
{
var items = new List<DrawableCarouselItem>();
var self = drawableRepresentation.Value;
var self = DrawableRepresentation.Value;
if (self?.IsPresent == true) items.Add(self);
return items;
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select.Carousel
protected CarouselItem()
{
drawableRepresentation = new Lazy<DrawableCarouselItem>(CreateDrawableRepresentation);
DrawableRepresentation = new Lazy<DrawableCarouselItem>(CreateDrawableRepresentation);
Filtered.ValueChanged += v =>
{
@ -44,13 +44,16 @@ namespace osu.Game.Screens.Select.Carousel
};
}
private readonly Lazy<DrawableCarouselItem> drawableRepresentation;
protected readonly Lazy<DrawableCarouselItem> DrawableRepresentation;
/// <summary>
/// Used as a default sort method for <see cref="CarouselItem"/>s of differing types.
/// </summary>
internal ulong ChildID;
/// <summary>
/// Create a fresh drawable version of this item. If you wish to consume the current representation, use <see cref="DrawableRepresentation"/> instead.
/// </summary>
protected abstract DrawableCarouselItem CreateDrawableRepresentation();
public virtual void Filter(FilterCriteria criteria)