Remove AsyncLoadWrapper dependence in MusicController

This commit is contained in:
Dean Herbert 2017-11-21 12:40:19 +09:00
parent 66f72baa39
commit 553a7947d7

View File

@ -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);
});
});
}