1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Fix potential sequen of execution issues in BeatmapCarousel

This commit is contained in:
Dean Herbert 2017-07-28 14:22:14 +09:00
parent a55586f2ad
commit e691dd12c5
2 changed files with 14 additions and 3 deletions

View File

@ -107,6 +107,14 @@ namespace osu.Game.Screens.Select
}); });
} }
public void RemoveBeatmap(BeatmapSetInfo beatmapSet)
{
Schedule(delegate
{
removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID));
});
}
public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true) public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true)
{ {
if (beatmap == null) if (beatmap == null)
@ -128,8 +136,6 @@ namespace osu.Game.Screens.Select
} }
} }
public void RemoveBeatmap(BeatmapSetInfo info) => removeGroup(groups.Find(b => b.BeatmapSet.ID == info.ID));
public Action<BeatmapInfo> SelectionChanged; public Action<BeatmapInfo> SelectionChanged;
public Action StartRequested; public Action StartRequested;

View File

@ -280,7 +280,7 @@ namespace osu.Game.Screens.Select
carousel.Filter(criteria, debounce); carousel.Filter(criteria, debounce);
} }
private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.AddBeatmap(s); private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s));
private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s)); private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s));
@ -375,6 +375,11 @@ namespace osu.Game.Screens.Select
} }
} }
private void addBeatmapSet(BeatmapSetInfo beatmapSet)
{
carousel.AddBeatmap(beatmapSet);
}
private void removeBeatmapSet(BeatmapSetInfo beatmapSet) private void removeBeatmapSet(BeatmapSetInfo beatmapSet)
{ {
carousel.RemoveBeatmap(beatmapSet); carousel.RemoveBeatmap(beatmapSet);