1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:57:24 +08:00

fixed static analysis problems and finished the implementation

This commit is contained in:
Joshua Hegedus 2023-11-09 13:27:09 +01:00
parent ccb9ff826a
commit 4900a91c60
No known key found for this signature in database
GPG Key ID: 331D6A883C797319
3 changed files with 31 additions and 32 deletions

View File

@ -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) private Drawable generateUser(string username, int id, CountryCode countryCode, string cover, bool onlyUsername, string? color = null)
{ {
return new ClickableAvatar(new APIUser return new ClickableAvatar(new APIUser
{
Username = username,
Id = id,
CountryCode = countryCode,
CoverUrl = cover,
Colour = color ?? "000000",
Status =
{ {
Username = username, Value = new UserStatusOnline()
Id = id, },
CountryCode = countryCode, })
CoverUrl = cover, {
Colour = color ?? "000000", Width = 50,
Status = Height = 50,
{ CornerRadius = 10,
Value = new UserStatusOnline() Masking = true,
}, EdgeEffect = new EdgeEffectParameters
})
{ {
Width = 50, Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f),
Height = 50, },
CornerRadius = 10, ShowUsernameOnly = onlyUsername,
Masking = true, };
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f),
},
ShowUsernameOnly = onlyUsername,
};
} }
} }
} }

View File

@ -21,9 +21,8 @@ namespace osu.Game.Users.Drawables
// public ITooltip<APIUser> GetCustomTooltip() => new APIUserTooltip(user!) { ShowTooltip = TooltipEnabled }; // public ITooltip<APIUser> GetCustomTooltip() => new APIUserTooltip(user!) { ShowTooltip = TooltipEnabled };
public ITooltip<APIUserTooltipContent> GetCustomTooltip() => new APIUserTooltip(new APIUserTooltipContent(user!)); 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 readonly APIUser? user;
private bool tooltipEnabled; private bool tooltipEnabled;
@ -35,7 +34,7 @@ namespace osu.Game.Users.Drawables
set set
{ {
tooltipEnabled = value; tooltipEnabled = value;
content.ShowUsernameOnly = ShowUsernameOnly; TooltipContent.ShowUsernameOnly = ShowUsernameOnly;
} }
} }
@ -53,7 +52,7 @@ namespace osu.Game.Users.Drawables
if (user?.Id != APIUser.SYSTEM_USER_ID) if (user?.Id != APIUser.SYSTEM_USER_ID)
Action = openProfile; Action = openProfile;
content = new APIUserTooltipContent(user!, ShowUsernameOnly); TooltipContent = new APIUserTooltipContent(user!, ShowUsernameOnly);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -80,6 +79,7 @@ namespace osu.Game.Users.Drawables
{ {
private OsuSpriteText text; private OsuSpriteText text;
private APIUserTooltipContent content; private APIUserTooltipContent content;
public APIUserTooltip(APIUserTooltipContent content) public APIUserTooltip(APIUserTooltipContent content)
{ {
this.content = content; this.content = content;
@ -91,7 +91,7 @@ namespace osu.Game.Users.Drawables
{ {
Width = 300 Width = 300
}; };
text = new OsuSpriteText() text = new OsuSpriteText
{ {
Text = this.content.User.Username Text = this.content.User.Username
}; };
@ -118,7 +118,7 @@ namespace osu.Game.Users.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Gray, Colour = Color4.Gray,
}, },
text = new OsuSpriteText() text = new OsuSpriteText
{ {
Font = FrameworkFont.Regular.With(size: 16), Font = FrameworkFont.Regular.With(size: 16),
Padding = new MarginPadding(5), Padding = new MarginPadding(5),

View File

@ -75,15 +75,14 @@ namespace osu.Game.Users.Drawables
return new ClickableAvatar(user) return new ClickableAvatar(user)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ShowUsernameOnly = showUsernameOnly
}; };
} }
else
return new DrawableAvatar(user)
{ {
return new DrawableAvatar(user) RelativeSizeAxes = Axes.Both,
{ };
RelativeSizeAxes = Axes.Both,
};
}
} }
} }
} }