Fix mod icons in ModSelect being loaded in a blocking fashion

This commit is contained in:
Dean Herbert 2019-06-20 23:06:07 +09:00
parent 35ce032be1
commit 52ca5f9c00
1 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@
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 @@ public string Header
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
private CancellationTokenSource modsLoadCts;
public IEnumerable<Mod> Mods
{
set
@ -48,7 +51,9 @@ public IEnumerable<Mod> Mods
};
}).ToArray();
ButtonsContainer.Children = modContainers;
modsLoadCts?.Cancel();
LoadComponentsAsync(modContainers, c => ButtonsContainer.ChildrenEnumerable = c, (modsLoadCts = new CancellationTokenSource()).Token);
buttons = modContainers.OfType<ModButton>().ToArray();
if (value.Any())