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

Remove AsyncLoadWrapper dependence

This commit is contained in:
Dean Herbert 2017-11-21 11:49:21 +09:00
parent e7654254d2
commit be9c99ade3

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
{
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
private Drawable beatmapInfoContainer;
private Drawable info;
public BeatmapInfoWedge()
{
@ -65,29 +65,34 @@ namespace osu.Game.Screens.Select
public void UpdateBeatmap(WorkingBeatmap beatmap)
{
var lastContainer = beatmapInfoContainer;
float newDepth = lastContainer?.Depth + 1 ?? 0;
Add(beatmapInfoContainer = new AsyncLoadWrapper(
new BufferedWedgeInfo(beatmap)
LoadComponentAsync(new BufferedWedgeInfo(beatmap)
{
Shear = -Shear,
OnLoadComplete = d =>
Depth = info?.Depth + 1 ?? 0,
}, newInfo =>
{
// ensure we ourselves are visible if not already.
if (!IsPresent)
this.FadeIn(250);
lastContainer?.FadeOut(250);
lastContainer?.Expire();
}
})
{
Depth = newDepth,
info?.FadeOut(250);
info?.Expire();
Add(info = newInfo);
});
}
public class BufferedWedgeInfo : BufferedContainer
{
private readonly WorkingBeatmap beatmap;
public BufferedWedgeInfo(WorkingBeatmap beatmap)
{
this.beatmap = beatmap;
}
[BackgroundDependencyLoader]
private void load()
{
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
@ -275,7 +280,8 @@ namespace osu.Game.Screens.Select
private class DifficultyColourBar : DifficultyColouredContainer
{
public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap)
public DifficultyColourBar(BeatmapInfo beatmap)
: base(beatmap)
{
}