mirror of
https://github.com/ppy/osu
synced 2025-03-02 09:30:57 +00:00
Fix mod icons in ModSelect being loaded in a blocking fashion
This commit is contained in:
parent
35ce032be1
commit
52ca5f9c00
@ -10,6 +10,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
@ -33,6 +34,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
||||||
|
|
||||||
|
private CancellationTokenSource modsLoadCts;
|
||||||
|
|
||||||
public IEnumerable<Mod> Mods
|
public IEnumerable<Mod> Mods
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -48,7 +51,9 @@ namespace osu.Game.Overlays.Mods
|
|||||||
};
|
};
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
|
||||||
ButtonsContainer.Children = modContainers;
|
modsLoadCts?.Cancel();
|
||||||
|
LoadComponentsAsync(modContainers, c => ButtonsContainer.ChildrenEnumerable = c, (modsLoadCts = new CancellationTokenSource()).Token);
|
||||||
|
|
||||||
buttons = modContainers.OfType<ModButton>().ToArray();
|
buttons = modContainers.OfType<ModButton>().ToArray();
|
||||||
|
|
||||||
if (value.Any())
|
if (value.Any())
|
||||||
|
Loading…
Reference in New Issue
Block a user