1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

fix with new event

This commit is contained in:
OliBomby 2022-09-13 02:20:52 +02:00
parent a1f4724685
commit fd48249eef
2 changed files with 10 additions and 4 deletions

View File

@ -24,11 +24,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
base.LoadComplete();
editorBeatmap.HitObjectUpdated += hitObjectUpdated;
editorBeatmap.SelectionBlueprintsShouldBeSorted += SortInternal;
}
private void hitObjectUpdated(HitObject _) => SortInternal();
public override void Add(SelectionBlueprint<HitObject> drawable)
{
SortInternal();
@ -72,7 +70,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
base.Dispose(isDisposing);
if (editorBeatmap != null)
editorBeatmap.HitObjectUpdated -= hitObjectUpdated;
editorBeatmap.SelectionBlueprintsShouldBeSorted -= SortInternal;
}
}
}

View File

@ -48,6 +48,11 @@ namespace osu.Game.Screens.Edit
/// </summary>
public event Action<HitObject> HitObjectUpdated;
/// <summary>
/// Invoked after <see cref="HitObjects"/> is updated during <see cref="UpdateState"/> and blueprints need to be sorted immediately to prevent a crash.
/// </summary>
public event Action SelectionBlueprintsShouldBeSorted;
/// <summary>
/// All currently selected <see cref="HitObject"/>s.
/// </summary>
@ -331,6 +336,9 @@ namespace osu.Game.Screens.Edit
beatmapProcessor?.PostProcess();
// Signal selection blueprint sorting because it is possible that the beatmap processor changed the order of the selection blueprints
SelectionBlueprintsShouldBeSorted?.Invoke();
// callbacks may modify the lists so let's be safe about it
var deletes = batchPendingDeletes.ToArray();
batchPendingDeletes.Clear();