1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 07:22:55 +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;
@ -126,9 +127,17 @@ namespace osu.Game.Overlays.Direct
{
if (Preview == null)
{
loading = true;
Preview = previewTrackManager.Get(beatmapSet);
loading = false;
Task.Run(() =>
{
loading = true;
return Preview = previewTrackManager.Get(beatmapSet);
})
.ContinueWith(t =>
{
playingStateChanged(true);
loading = false;
});
return;
}
previewTrackManager.Play(Preview);