mirror of https://github.com/ppy/osu
Fix beatmap background being disposed too early
Causes weird transitions on the music controller
This commit is contained in:
parent
cf251b70c7
commit
67b3cbce2f
|
@ -152,14 +152,10 @@ private void load()
|
||||||
|
|
||||||
Beatmap.ValueChanged += b =>
|
Beatmap.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
// compare to last baetmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
||||||
if (lastBeatmap?.Track != b.Track)
|
if (lastBeatmap?.Track != b.Track)
|
||||||
{
|
{
|
||||||
// this disposal is done to stop the audio track.
|
lastBeatmap?.Track?.Dispose();
|
||||||
// it may not be exactly what we want for cases beatmaps are reused, as it will
|
|
||||||
// trigger a fresh load of contained resources.
|
|
||||||
lastBeatmap?.Dispose();
|
|
||||||
|
|
||||||
Audio.Track.AddItem(b.Track);
|
Audio.Track.AddItem(b.Track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,23 +348,23 @@ private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
|
||||||
|
|
||||||
playerContainer.Add(new AsyncLoadWrapper(new Background(beatmap)
|
playerContainer.Add(new AsyncLoadWrapper(new Background(beatmap)
|
||||||
{
|
{
|
||||||
OnLoadComplete = d =>
|
OnLoadComplete = newBackground =>
|
||||||
{
|
{
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case TransformDirection.Next:
|
case TransformDirection.Next:
|
||||||
d.Position = new Vector2(400, 0);
|
newBackground.Position = new Vector2(400, 0);
|
||||||
d.MoveToX(0, 500, Easing.OutCubic);
|
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||||
currentBackground.MoveToX(-400, 500, Easing.OutCubic);
|
currentBackground.MoveToX(-400, 500, Easing.OutCubic);
|
||||||
break;
|
break;
|
||||||
case TransformDirection.Prev:
|
case TransformDirection.Prev:
|
||||||
d.Position = new Vector2(-400, 0);
|
newBackground.Position = new Vector2(-400, 0);
|
||||||
d.MoveToX(0, 500, Easing.OutCubic);
|
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||||
currentBackground.MoveToX(400, 500, Easing.OutCubic);
|
currentBackground.MoveToX(400, 500, Easing.OutCubic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentBackground.Expire();
|
currentBackground.Expire();
|
||||||
currentBackground = d;
|
currentBackground = newBackground;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue