mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 17:27:48 +08:00
fixed static analysis problems and finished the implementation
This commit is contained in:
parent
ccb9ff826a
commit
4900a91c60
@ -105,28 +105,28 @@ namespace osu.Game.Tests.Visual.Online
|
||||
private Drawable generateUser(string username, int id, CountryCode countryCode, string cover, bool onlyUsername, string? color = null)
|
||||
{
|
||||
return new ClickableAvatar(new APIUser
|
||||
{
|
||||
Username = username,
|
||||
Id = id,
|
||||
CountryCode = countryCode,
|
||||
CoverUrl = cover,
|
||||
Colour = color ?? "000000",
|
||||
Status =
|
||||
{
|
||||
Username = username,
|
||||
Id = id,
|
||||
CountryCode = countryCode,
|
||||
CoverUrl = cover,
|
||||
Colour = color ?? "000000",
|
||||
Status =
|
||||
{
|
||||
Value = new UserStatusOnline()
|
||||
},
|
||||
})
|
||||
Value = new UserStatusOnline()
|
||||
},
|
||||
})
|
||||
{
|
||||
Width = 50,
|
||||
Height = 50,
|
||||
CornerRadius = 10,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Width = 50,
|
||||
Height = 50,
|
||||
CornerRadius = 10,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f),
|
||||
},
|
||||
ShowUsernameOnly = onlyUsername,
|
||||
};
|
||||
Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f),
|
||||
},
|
||||
ShowUsernameOnly = onlyUsername,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,8 @@ namespace osu.Game.Users.Drawables
|
||||
// public ITooltip<APIUser> GetCustomTooltip() => new APIUserTooltip(user!) { ShowTooltip = TooltipEnabled };
|
||||
public ITooltip<APIUserTooltipContent> GetCustomTooltip() => new APIUserTooltip(new APIUserTooltipContent(user!));
|
||||
|
||||
public APIUserTooltipContent TooltipContent => content;
|
||||
public APIUserTooltipContent TooltipContent { get; }
|
||||
|
||||
private readonly APIUserTooltipContent content;
|
||||
private readonly APIUser? user;
|
||||
private bool tooltipEnabled;
|
||||
|
||||
@ -35,7 +34,7 @@ namespace osu.Game.Users.Drawables
|
||||
set
|
||||
{
|
||||
tooltipEnabled = value;
|
||||
content.ShowUsernameOnly = ShowUsernameOnly;
|
||||
TooltipContent.ShowUsernameOnly = ShowUsernameOnly;
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +52,7 @@ namespace osu.Game.Users.Drawables
|
||||
if (user?.Id != APIUser.SYSTEM_USER_ID)
|
||||
Action = openProfile;
|
||||
|
||||
content = new APIUserTooltipContent(user!, ShowUsernameOnly);
|
||||
TooltipContent = new APIUserTooltipContent(user!, ShowUsernameOnly);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -80,6 +79,7 @@ namespace osu.Game.Users.Drawables
|
||||
{
|
||||
private OsuSpriteText text;
|
||||
private APIUserTooltipContent content;
|
||||
|
||||
public APIUserTooltip(APIUserTooltipContent content)
|
||||
{
|
||||
this.content = content;
|
||||
@ -91,7 +91,7 @@ namespace osu.Game.Users.Drawables
|
||||
{
|
||||
Width = 300
|
||||
};
|
||||
text = new OsuSpriteText()
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Text = this.content.User.Username
|
||||
};
|
||||
@ -118,7 +118,7 @@ namespace osu.Game.Users.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Gray,
|
||||
},
|
||||
text = new OsuSpriteText()
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Font = FrameworkFont.Regular.With(size: 16),
|
||||
Padding = new MarginPadding(5),
|
||||
|
@ -75,15 +75,14 @@ namespace osu.Game.Users.Drawables
|
||||
return new ClickableAvatar(user)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ShowUsernameOnly = showUsernameOnly
|
||||
};
|
||||
}
|
||||
else
|
||||
|
||||
return new DrawableAvatar(user)
|
||||
{
|
||||
return new DrawableAvatar(user)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
}
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user