mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Merge pull request #1193 from peppy/beatmap-background-disposal-fix
Fix beatmap background being disposed too early
This commit is contained in:
@ -152,14 +152,10 @@ namespace osu.Game
|
|||||||
|
|
||||||
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 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user