diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index dbc132995a..e583acac9f 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.cs @@ -21,31 +21,45 @@ namespace osu.Game.Users set => Model = value; } - [Resolved] - private LargeTextureStore textures { get; set; } + protected override Drawable CreateDrawable(User user) => new Cover(user); - protected override Drawable CreateDrawable(User user) + private class Cover : CompositeDrawable { - if (user == null) + private readonly User user; + + public Cover(User user) { - return new Box - { - RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) - }; + this.user = user; + + RelativeSizeAxes = Axes.Both; } - else + + [BackgroundDependencyLoader] + private void load(LargeTextureStore textures) { - var sprite = new Sprite + if (user == null) { - RelativeSizeAxes = Axes.Both, - Texture = textures.Get(user.CoverUrl), - FillMode = FillMode.Fill, - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }; - sprite.OnLoadComplete += d => d.FadeInFromZero(400); - return sprite; + InternalChild = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) + }; + } + else + InternalChild = new Sprite + { + RelativeSizeAxes = Axes.Both, + Texture = textures.Get(user.CoverUrl), + FillMode = FillMode.Fill, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + this.FadeInFromZero(400); } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 833c62013b..4b2029e6fd 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -66,8 +66,6 @@ namespace osu.Game.Users FillFlowContainer infoContainer; - UserCoverBackground coverBackground; - AddInternal(content = new Container { RelativeSizeAxes = Axes.Both, @@ -82,13 +80,16 @@ namespace osu.Game.Users Children = new Drawable[] { - new DelayedLoadWrapper(coverBackground = new UserCoverBackground + new DelayedLoadUnloadWrapper(() => new UserCoverBackground { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, User = user, - }, 300) { RelativeSizeAxes = Axes.Both }, + }, 300, 5000) + { + RelativeSizeAxes = Axes.Both, + }, new Box { RelativeSizeAxes = Axes.Both, @@ -189,8 +190,6 @@ namespace osu.Game.Users } }); - coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out); - if (user.IsSupporter) { infoContainer.Add(new SupporterIcon