mirror of
https://github.com/ppy/osu
synced 2025-01-22 22:03:12 +00: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]
|
||||
public class DrawableAvatar : Sprite
|
||||
{
|
||||
private readonly APIUser user;
|
||||
private readonly IUser user;
|
||||
|
||||
/// <summary>
|
||||
/// A simple, non-interactable avatar sprite for the specified user.
|
||||
/// </summary>
|
||||
/// <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;
|
||||
|
||||
@ -33,10 +33,10 @@ namespace osu.Game.Users.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
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
|
||||
// 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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user