Changed to LoadComponentAsync call instead of adding an AsyncLoadWrapper instance.

This commit is contained in:
FreezyLemon 2017-11-21 16:12:23 +01:00
parent 7c65048ae5
commit a033eb46d3
5 changed files with 37 additions and 31 deletions

View File

@ -146,18 +146,17 @@ namespace osu.Game.Overlays.Direct
loading = true; loading = true;
Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3") LoadComponentAsync(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3"),
{ d =>
OnLoadComplete = d =>
{ {
// we may have been replaced by another loader // We may have been replaced by another loader
if (trackLoader != d) return; if (trackLoader != d) return;
Preview = (d as TrackLoader)?.Preview; Preview = (d as TrackLoader)?.Preview;
Playing.TriggerChange(); Playing.TriggerChange();
loading = false; loading = false;
}, Add(trackLoader);
})); });
} }
private class TrackLoader : Drawable private class TrackLoader : Drawable

View File

@ -316,18 +316,18 @@ namespace osu.Game.Overlays.Profile
private void loadUser() private void loadUser()
{ {
coverContainer.Add(new AsyncLoadWrapper(new UserCoverBackground(user) LoadComponentAsync(new UserCoverBackground(user)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200) OnLoadComplete = d => d.FadeInFromZero(200)
}) },
ucb =>
{ {
Masking = true, ucb.Depth = float.MaxValue;
RelativeSizeAxes = Axes.Both, coverContainer.Add(ucb);
Depth = float.MaxValue
}); });
if (user.IsSupporter) supporterTag.Show(); if (user.IsSupporter) supporterTag.Show();

View File

@ -228,16 +228,19 @@ namespace osu.Game.Screens.Multiplayer
if (value != null) if (value != null)
{ {
coverContainer.FadeIn(transition_duration); coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
{ {
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) Anchor = Anchor.Centre,
{ Origin = Anchor.Centre,
Anchor = Anchor.Centre, FillMode = FillMode.Fill,
Origin = Anchor.Centre, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
FillMode = FillMode.Fill, },
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), bsc =>
}) { RelativeSizeAxes = Axes.Both }, {
}; bsc.RelativeSizeAxes = Axes.Both;
coverContainer.Add(bsc);
});
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - "; beatmapDash.Text = @" - ";

View File

@ -329,17 +329,20 @@ namespace osu.Game.Screens.Multiplayer
if (value != null) if (value != null)
{ {
coverContainer.FadeIn(transition_duration); coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
{ {
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) RelativeSizeAxes = Axes.Both,
{ Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both, Origin = Anchor.Centre,
Anchor = Anchor.Centre, FillMode = FillMode.Fill,
Origin = Anchor.Centre, OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
FillMode = FillMode.Fill, },
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out), bsc =>
}) { RelativeSizeAxes = Axes.Both }, {
}; bsc.RelativeSizeAxes = Axes.Both;
coverContainer.Add(bsc);
});
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - "; beatmapDash.Text = @" - ";

View File

@ -248,7 +248,8 @@ namespace osu.Game.Screens.Play
storyboard = beatmap.Storyboard.CreateDrawable(Beatmap.Value); storyboard = beatmap.Storyboard.CreateDrawable(Beatmap.Value);
storyboard.Masking = true; storyboard.Masking = true;
storyboardContainer.Add(asyncLoad ? new AsyncLoadWrapper(storyboard) { RelativeSizeAxes = Axes.Both } : (Drawable)storyboard); if (asyncLoad) LoadComponentAsync(storyboard, s => storyboardContainer.Add(s));
else storyboardContainer.Add((Drawable)storyboard);
} }
public void Restart() public void Restart()