1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 13:27:23 +08:00

Fix several schedule-related issues arising from new column addition

This commit is contained in:
Bartłomiej Dach 2022-08-15 20:34:09 +02:00
parent 5ff2e41a55
commit f860bc11ee
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 18 additions and 2 deletions

View File

@ -66,7 +66,10 @@ namespace osu.Game.Overlays.Mods
private IModHotkeyHandler hotkeyHandler = null!;
private Task? latestLoadTask;
internal bool ItemsLoaded => latestLoadTask?.IsCompleted == true;
private bool itemsLoaded;
internal bool ItemsLoaded => latestLoadTask?.IsCompleted == true && itemsLoaded;
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
public ModColumn(ModType modType, bool allowIncompatibleSelection)
{
@ -132,10 +135,12 @@ namespace osu.Game.Overlays.Mods
var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = Vector2.Zero));
itemsLoaded = false;
latestLoadTask = LoadComponentsAsync(panels, loaded =>
{
ItemsFlow.ChildrenEnumerable = loaded;
updateState();
itemsLoaded = true;
}, (cancellationTokenSource = new CancellationTokenSource()).Token);
}

View File

@ -708,7 +708,18 @@ namespace osu.Game.Overlays.Mods
FinishTransforms();
}
protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate || (Column as ModColumn)?.SelectionAnimationRunning == true;
protected override bool RequiresChildrenUpdate
{
get
{
bool result = base.RequiresChildrenUpdate;
if (Column is ModColumn modColumn)
result |= !modColumn.ItemsLoaded || modColumn.SelectionAnimationRunning;
return result;
}
}
private void updateState()
{