1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 14:52:55 +08:00

Merge pull request #5005 from peppy/fix-social-overlay-performance

Fix abysmal load performance when showing the social overlay
This commit is contained in:
Dean Herbert 2019-06-12 21:14:33 +09:00 committed by GitHub
commit 224e417f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 25 deletions

View File

@ -21,22 +21,32 @@ namespace osu.Game.Users
set => Model = value; set => Model = value;
} }
[Resolved] protected override Drawable CreateDrawable(User user) => new Cover(user);
private LargeTextureStore textures { get; set; }
protected override Drawable CreateDrawable(User user) private class Cover : CompositeDrawable
{
private readonly User user;
public Cover(User user)
{
this.user = user;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{ {
if (user == null) if (user == null)
{ {
return new Box InternalChild = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f))
}; };
} }
else else
{ InternalChild = new Sprite
var sprite = new Sprite
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Texture = textures.Get(user.CoverUrl), Texture = textures.Get(user.CoverUrl),
@ -44,8 +54,12 @@ namespace osu.Game.Users
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
}; };
sprite.OnLoadComplete += d => d.FadeInFromZero(400); }
return sprite;
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeInFromZero(400);
} }
} }
} }

View File

@ -66,8 +66,6 @@ namespace osu.Game.Users
FillFlowContainer infoContainer; FillFlowContainer infoContainer;
UserCoverBackground coverBackground;
AddInternal(content = new Container AddInternal(content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -82,13 +80,16 @@ namespace osu.Game.Users
Children = new Drawable[] Children = new Drawable[]
{ {
new DelayedLoadWrapper(coverBackground = new UserCoverBackground new DelayedLoadUnloadWrapper(() => new UserCoverBackground
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
User = user, User = user,
}, 300) { RelativeSizeAxes = Axes.Both }, }, 300, 5000)
{
RelativeSizeAxes = Axes.Both,
},
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -189,8 +190,6 @@ namespace osu.Game.Users
} }
}); });
coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out);
if (user.IsSupporter) if (user.IsSupporter)
{ {
infoContainer.Add(new SupporterIcon infoContainer.Add(new SupporterIcon