1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 07:32:55 +08:00

Clean up beatmapSet resolution in DrawableCarouselBeatmapSet

This commit is contained in:
Dean Herbert 2020-10-13 19:20:46 +09:00
parent 75b6a5e17e
commit 3d416f4d64

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -34,10 +35,10 @@ namespace osu.Game.Screens.Select.Carousel
public IEnumerable<DrawableCarouselItem> DrawableBeatmaps => beatmapContainer?.Children ?? Enumerable.Empty<DrawableCarouselItem>(); public IEnumerable<DrawableCarouselItem> DrawableBeatmaps => beatmapContainer?.Children ?? Enumerable.Empty<DrawableCarouselItem>();
private BeatmapSetInfo beatmapSet => (Item as CarouselBeatmapSet)?.BeatmapSet;
private Container<DrawableCarouselItem> beatmapContainer; private Container<DrawableCarouselItem> beatmapContainer;
private BeatmapSetInfo beatmapSet;
[Resolved] [Resolved]
private BeatmapManager manager { get; set; } private BeatmapManager manager { get; set; }
@ -69,6 +70,8 @@ namespace osu.Game.Screens.Select.Carousel
if (Item == null) if (Item == null)
return; return;
beatmapSet = ((CarouselBeatmapSet)Item).BeatmapSet;
DelayedLoadWrapper background; DelayedLoadWrapper background;
DelayedLoadWrapper mainFlow; DelayedLoadWrapper mainFlow;
@ -161,6 +164,8 @@ namespace osu.Game.Screens.Select.Carousel
{ {
get get
{ {
Debug.Assert(beatmapSet != null);
List<MenuItem> items = new List<MenuItem>(); List<MenuItem> items = new List<MenuItem>();
if (Item.State.Value == CarouselItemState.NotSelected) if (Item.State.Value == CarouselItemState.NotSelected)
@ -189,6 +194,8 @@ namespace osu.Game.Screens.Select.Carousel
private MenuItem createCollectionMenuItem(BeatmapCollection collection) private MenuItem createCollectionMenuItem(BeatmapCollection collection)
{ {
Debug.Assert(beatmapSet != null);
TernaryState state; TernaryState state;
var countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b)); var countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b));