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

Load PlayButton.Preview asynchronously

This commit is contained in:
Roman Kapustin 2018-05-09 16:22:52 +03:00
parent c492f62eda
commit 95dd2125ee

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
@ -125,10 +126,18 @@ namespace osu.Game.Overlays.Direct
if (playing)
{
if (Preview == null)
{
Task.Run(() =>
{
loading = true;
Preview = previewTrackManager.Get(beatmapSet);
return Preview = previewTrackManager.Get(beatmapSet);
})
.ContinueWith(t =>
{
playingStateChanged(true);
loading = false;
});
return;
}
previewTrackManager.Play(Preview);