mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Fix abysmal load performance when showing the social overlay
This commit is contained in:
parent
73e561bf10
commit
0f000fcc14
@ -21,22 +21,32 @@ 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
|
||||
{
|
||||
private readonly User user;
|
||||
|
||||
public Cover(User user)
|
||||
{
|
||||
this.user = user;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return new Box
|
||||
InternalChild = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f))
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var sprite = new Sprite
|
||||
InternalChild = new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Texture = textures.Get(user.CoverUrl),
|
||||
@ -44,8 +54,12 @@ namespace osu.Game.Users
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
};
|
||||
sprite.OnLoadComplete += d => d.FadeInFromZero(400);
|
||||
return sprite;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
this.FadeInFromZero(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,6 @@ namespace osu.Game.Users
|
||||
|
||||
FillFlowContainer infoContainer;
|
||||
|
||||
UserCoverBackground coverBackground;
|
||||
|
||||
AddInternal(content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -77,13 +75,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,
|
||||
@ -184,8 +185,6 @@ namespace osu.Game.Users
|
||||
}
|
||||
});
|
||||
|
||||
coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out);
|
||||
|
||||
if (user.IsSupporter)
|
||||
{
|
||||
infoContainer.Add(new SupporterIcon
|
||||
|
Loading…
Reference in New Issue
Block a user