mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 04:13:03 +08:00
Allow DrawableAvatar
to accept an IUser
for now
This commit is contained in:
parent
d251c0b2ac
commit
ac58c222b9
@ -14,13 +14,13 @@ namespace osu.Game.Users.Drawables
|
|||||||
[LongRunningLoad]
|
[LongRunningLoad]
|
||||||
public class DrawableAvatar : Sprite
|
public class DrawableAvatar : Sprite
|
||||||
{
|
{
|
||||||
private readonly APIUser user;
|
private readonly IUser user;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simple, non-interactable avatar sprite for the specified user.
|
/// A simple, non-interactable avatar sprite for the specified user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user. A null value will get a placeholder avatar.</param>
|
/// <param name="user">The user. A null value will get a placeholder avatar.</param>
|
||||||
public DrawableAvatar(APIUser user = null)
|
public DrawableAvatar(IUser user = null)
|
||||||
{
|
{
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
@ -33,10 +33,10 @@ namespace osu.Game.Users.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LargeTextureStore textures)
|
private void load(LargeTextureStore textures)
|
||||||
{
|
{
|
||||||
if (user != null && user.Id > 1)
|
if (user != null && user.OnlineID > 1)
|
||||||
// TODO: The fallback here should not need to exist. Users should be looked up and populated via UserLookupCache or otherwise
|
// TODO: The fallback here should not need to exist. Users should be looked up and populated via UserLookupCache or otherwise
|
||||||
// in remaining cases where this is required (chat tabs, local leaderboard), at which point this should be removed.
|
// in remaining cases where this is required (chat tabs, local leaderboard), at which point this should be removed.
|
||||||
Texture = textures.Get(user.AvatarUrl ?? $@"https://a.ppy.sh/{user.Id}");
|
Texture = textures.Get((user as APIUser)?.AvatarUrl ?? $@"https://a.ppy.sh/{user.OnlineID}");
|
||||||
|
|
||||||
Texture ??= textures.Get(@"Online/avatar-guest");
|
Texture ??= textures.Get(@"Online/avatar-guest");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user