mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 21:07:33 +08:00
Fix possible incorrect order of events due to threaded load
This commit is contained in:
parent
b2066c5d73
commit
40ed3fdd05
@ -96,27 +96,29 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
if (!Playing.Value)
|
||||
{
|
||||
if (Preview == null)
|
||||
if (Preview != null)
|
||||
{
|
||||
Preview.Start();
|
||||
return true;
|
||||
}
|
||||
|
||||
loading = true;
|
||||
|
||||
Preview = previewTrackManager.Get(beatmapSet);
|
||||
Preview.Started += () => Playing.Value = true;
|
||||
Preview.Stopped += () => Playing.Value = false;
|
||||
var loadingPreview = previewTrackManager.Get(beatmapSet);
|
||||
loadingPreview.Started += () => Playing.Value = true;
|
||||
loadingPreview.Stopped += () => Playing.Value = false;
|
||||
|
||||
LoadComponentAsync(Preview, t =>
|
||||
LoadComponentAsync(Preview = loadingPreview, t =>
|
||||
{
|
||||
if (Preview != loadingPreview)
|
||||
return;
|
||||
|
||||
AddInternal(t);
|
||||
|
||||
Preview.Start();
|
||||
|
||||
loading = false;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Preview.Start();
|
||||
}
|
||||
else
|
||||
Preview?.Stop();
|
||||
|
Loading…
Reference in New Issue
Block a user