mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:57:52 +08:00
Use avatar_url from user first instead of a.ppy.sh in DrawableAvatar
This commit is contained in:
parent
b9b0623c83
commit
34429a02e7
@ -5,6 +5,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
namespace osu.Game.Users.Drawables
|
namespace osu.Game.Users.Drawables
|
||||||
{
|
{
|
||||||
@ -13,6 +14,9 @@ namespace osu.Game.Users.Drawables
|
|||||||
{
|
{
|
||||||
private readonly User user;
|
private readonly User user;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull=true)]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simple, non-interactable avatar sprite for the specified user.
|
/// A simple, non-interactable avatar sprite for the specified user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -30,9 +34,11 @@ namespace osu.Game.Users.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LargeTextureStore textures)
|
private void load(LargeTextureStore textures)
|
||||||
{
|
{
|
||||||
if (user != null && user.Id > 1)
|
if (api != null && user?.AvatarUrl != null)
|
||||||
|
Texture = textures.Get(user.AvatarUrl.StartsWith('/') ? $"{api.WebsiteRootUrl}{user.AvatarUrl}" : user.AvatarUrl);
|
||||||
|
else if (user != null && user.Id > 1)
|
||||||
Texture = textures.Get($@"https://a.ppy.sh/{user.Id}");
|
Texture = textures.Get($@"https://a.ppy.sh/{user.Id}");
|
||||||
|
|
||||||
Texture ??= textures.Get(@"Online/avatar-guest");
|
Texture ??= textures.Get(@"Online/avatar-guest");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user