mirror of
https://github.com/ppy/osu
synced 2025-01-05 13:50:03 +00:00
Remove AsyncLoadWrapper dependence in MusicController
This commit is contained in:
parent
66f72baa39
commit
553a7947d7
@ -37,7 +37,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
private const float bottom_black_area_height = 55;
|
||||
|
||||
private Drawable currentBackground;
|
||||
private Drawable background;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
private IconButton prevButton;
|
||||
@ -120,7 +120,7 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
Children = new[]
|
||||
{
|
||||
currentBackground = new Background(),
|
||||
background = new Background(),
|
||||
title = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
@ -334,6 +334,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
pendingBeatmapSwitch = Schedule(delegate
|
||||
{
|
||||
// todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync()
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists
|
||||
@ -352,29 +353,26 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
});
|
||||
|
||||
playerContainer.Add(new AsyncLoadWrapper(new Background(beatmap)
|
||||
LoadComponentAsync(new Background(beatmap) { Depth = float.MaxValue }, newBackground =>
|
||||
{
|
||||
OnLoadComplete = newBackground =>
|
||||
switch (direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case TransformDirection.Next:
|
||||
newBackground.Position = new Vector2(400, 0);
|
||||
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||
currentBackground.MoveToX(-400, 500, Easing.OutCubic);
|
||||
break;
|
||||
case TransformDirection.Prev:
|
||||
newBackground.Position = new Vector2(-400, 0);
|
||||
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||
currentBackground.MoveToX(400, 500, Easing.OutCubic);
|
||||
break;
|
||||
}
|
||||
currentBackground.Expire();
|
||||
currentBackground = newBackground;
|
||||
case TransformDirection.Next:
|
||||
newBackground.Position = new Vector2(400, 0);
|
||||
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||
background.MoveToX(-400, 500, Easing.OutCubic);
|
||||
break;
|
||||
case TransformDirection.Prev:
|
||||
newBackground.Position = new Vector2(-400, 0);
|
||||
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||
background.MoveToX(400, 500, Easing.OutCubic);
|
||||
break;
|
||||
}
|
||||
})
|
||||
{
|
||||
Depth = float.MaxValue,
|
||||
|
||||
background.Expire();
|
||||
background = newBackground;
|
||||
|
||||
playerContainer.Add(newBackground);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user