mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
CoverBackgroundSprite for actually async cover loading
This commit is contained in:
@ -159,22 +159,21 @@ namespace osu.Game.Users
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cover.Add(new AsyncLoadWrapper(new CoverBackgroundSprite(user)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
FillMode = FillMode.Fill,
|
||||||
|
OnLoadComplete = d => d.FadeInFromZero(200),
|
||||||
|
}) { RelativeSizeAxes = Axes.Both });
|
||||||
|
|
||||||
Status.ValueChanged += displayStatus;
|
Status.ValueChanged += displayStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, TextureStore textures)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
this.colours = colours;
|
this.colours = colours;
|
||||||
|
|
||||||
cover.Add(new AsyncLoadWrapper(new Sprite
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Texture = textures.Get(user.CoverUrl),
|
|
||||||
FillMode = FillMode.Fill,
|
|
||||||
OnLoadComplete = d => d.FadeInFromZero(200),
|
|
||||||
}) { RelativeSizeAxes = Axes.Both });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayStatus(UserStatus status)
|
private void displayStatus(UserStatus status)
|
||||||
@ -182,5 +181,22 @@ namespace osu.Game.Users
|
|||||||
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint);
|
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint);
|
||||||
statusMessage.Text = status.Message;
|
statusMessage.Text = status.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class CoverBackgroundSprite : Sprite
|
||||||
|
{
|
||||||
|
private readonly User user;
|
||||||
|
|
||||||
|
public CoverBackgroundSprite(User user)
|
||||||
|
{
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(user.CoverUrl))
|
||||||
|
Texture = textures.Get(user.CoverUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user