From 52ca5f9c006a56e30f4e076f9925457ecccdd713 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Jun 2019 23:06:07 +0900 Subject: [PATCH] Fix mod icons in ModSelect being loaded in a blocking fashion --- osu.Game/Overlays/Mods/ModSection.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 4c44aad87d..ba83af9f28 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Mods; using System; using System.Linq; using System.Collections.Generic; +using System.Threading; using osu.Framework.Input.Events; using osu.Game.Graphics; @@ -33,6 +34,8 @@ namespace osu.Game.Overlays.Mods public IEnumerable SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null); + private CancellationTokenSource modsLoadCts; + public IEnumerable Mods { set @@ -48,7 +51,9 @@ namespace osu.Game.Overlays.Mods }; }).ToArray(); - ButtonsContainer.Children = modContainers; + modsLoadCts?.Cancel(); + LoadComponentsAsync(modContainers, c => ButtonsContainer.ChildrenEnumerable = c, (modsLoadCts = new CancellationTokenSource()).Token); + buttons = modContainers.OfType().ToArray(); if (value.Any())