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:
parent
e7654254d2
commit
be9c99ade3
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
|
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
|
||||||
|
|
||||||
private Drawable beatmapInfoContainer;
|
private Drawable info;
|
||||||
|
|
||||||
public BeatmapInfoWedge()
|
public BeatmapInfoWedge()
|
||||||
{
|
{
|
||||||
@ -65,29 +65,34 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
var lastContainer = beatmapInfoContainer;
|
LoadComponentAsync(new BufferedWedgeInfo(beatmap)
|
||||||
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
|
||||||
|
|
||||||
Add(beatmapInfoContainer = new AsyncLoadWrapper(
|
|
||||||
new BufferedWedgeInfo(beatmap)
|
|
||||||
{
|
|
||||||
Shear = -Shear,
|
|
||||||
OnLoadComplete = d =>
|
|
||||||
{
|
|
||||||
this.FadeIn(250);
|
|
||||||
|
|
||||||
lastContainer?.FadeOut(250);
|
|
||||||
lastContainer?.Expire();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
{
|
{
|
||||||
Depth = newDepth,
|
Shear = -Shear,
|
||||||
|
Depth = info?.Depth + 1 ?? 0,
|
||||||
|
}, newInfo =>
|
||||||
|
{
|
||||||
|
// ensure we ourselves are visible if not already.
|
||||||
|
if (!IsPresent)
|
||||||
|
this.FadeIn(250);
|
||||||
|
|
||||||
|
info?.FadeOut(250);
|
||||||
|
info?.Expire();
|
||||||
|
|
||||||
|
Add(info = newInfo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BufferedWedgeInfo : BufferedContainer
|
public class BufferedWedgeInfo : BufferedContainer
|
||||||
{
|
{
|
||||||
|
private readonly WorkingBeatmap beatmap;
|
||||||
|
|
||||||
public BufferedWedgeInfo(WorkingBeatmap beatmap)
|
public BufferedWedgeInfo(WorkingBeatmap beatmap)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
|
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
|
||||||
BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
@ -206,13 +211,13 @@ namespace osu.Game.Screens.Select
|
|||||||
Font = @"Exo2.0-Medium",
|
Font = @"Exo2.0-Medium",
|
||||||
Text = "mapped by ",
|
Text = "mapped by ",
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Text = metadata.Author.Username,
|
Text = metadata.Author.Username,
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
@ -244,38 +249,39 @@ namespace osu.Game.Screens.Select
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteIcon
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_square,
|
Icon = FontAwesome.fa_square,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Colour = new Color4(68, 17, 136, 255),
|
Colour = new Color4(68, 17, 136, 255),
|
||||||
Rotation = 45,
|
Rotation = 45,
|
||||||
Size = new Vector2(20),
|
Size = new Vector2(20),
|
||||||
},
|
},
|
||||||
new SpriteIcon
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
Icon = statistic.Icon,
|
Icon = statistic.Icon,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Colour = new Color4(255, 221, 85, 255),
|
Colour = new Color4(255, 221, 85, 255),
|
||||||
Scale = new Vector2(0.8f),
|
Scale = new Vector2(0.8f),
|
||||||
Size = new Vector2(20),
|
Size = new Vector2(20),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Left = 13 },
|
Margin = new MarginPadding { Left = 13 },
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Colour = new Color4(255, 221, 85, 255),
|
Colour = new Color4(255, 221, 85, 255),
|
||||||
Text = statistic.Content,
|
Text = statistic.Content,
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Origin = Anchor.CentreLeft
|
Origin = Anchor.CentreLeft
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DifficultyColourBar : DifficultyColouredContainer
|
private class DifficultyColourBar : DifficultyColouredContainer
|
||||||
{
|
{
|
||||||
public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap)
|
public DifficultyColourBar(BeatmapInfo beatmap)
|
||||||
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,21 +292,21 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = AccentColour,
|
Colour = AccentColour,
|
||||||
Width = full_opacity_ratio,
|
Width = full_opacity_ratio,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
Colour = AccentColour,
|
Colour = AccentColour,
|
||||||
Alpha = 0.5f,
|
Alpha = 0.5f,
|
||||||
X = full_opacity_ratio,
|
X = full_opacity_ratio,
|
||||||
Width = 1 - full_opacity_ratio,
|
Width = 1 - full_opacity_ratio,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user