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

Fix MusicController doing work in the background when not visible.

This commit is contained in:
Dean Herbert 2017-02-09 11:28:13 +09:00
parent 2e5ad31cc7
commit f6956fc51c
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49

View File

@ -23,6 +23,7 @@ using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Threading;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays
@ -229,6 +230,12 @@ namespace osu.Game.Overlays
{
base.Update();
if (pendingBeatmapSwitch != null)
{
pendingBeatmapSwitch();
pendingBeatmapSwitch = null;
}
if (current?.TrackLoaded ?? false)
{
@ -320,7 +327,13 @@ namespace osu.Game.Overlays
base.PerformLoad(game);
}
Action pendingBeatmapSwitch;
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
{
//we might be off-screen when this update comes in.
//rather than Scheduling, manually handle this to avoid possible memory contention.
pendingBeatmapSwitch = () =>
{
Task.Run(() =>
{
@ -357,6 +370,7 @@ namespace osu.Game.Overlays
backgroundSprite.Expire();
backgroundSprite = newBackground;
});
};
}
private Func<string, string, string> unicodeString;