mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 14:42:56 +08:00
Perform all user profile displays using an IUser
interface
This commit is contained in:
parent
ba74dd93b2
commit
b1f1cc0bf3
@ -53,8 +53,10 @@ using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Performance;
|
||||
using osu.Game.Skinning.Editor;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
@ -323,10 +325,9 @@ namespace osu.Game
|
||||
break;
|
||||
|
||||
case LinkAction.OpenUserProfile:
|
||||
if (int.TryParse(link.Argument, out int userId))
|
||||
ShowUser(userId);
|
||||
else
|
||||
ShowUser(link.Argument);
|
||||
ShowUser(int.TryParse(link.Argument, out int userId)
|
||||
? new APIUser { Id = userId }
|
||||
: new APIUser { Username = link.Argument });
|
||||
|
||||
break;
|
||||
|
||||
@ -383,14 +384,8 @@ namespace osu.Game
|
||||
/// <summary>
|
||||
/// Show a user's profile as an overlay.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user to display.</param>
|
||||
public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
|
||||
|
||||
/// <summary>
|
||||
/// Show a user's profile as an overlay.
|
||||
/// </summary>
|
||||
/// <param name="username">The user to display.</param>
|
||||
public void ShowUser(string username) => waitForReady(() => userProfile, _ => userProfile.ShowUser(username));
|
||||
/// <param name="user">The user to display.</param>
|
||||
public void ShowUser(IUser user) => waitForReady(() => userProfile, _ => userProfile.ShowUser(user));
|
||||
|
||||
/// <summary>
|
||||
/// Show a beatmap's set as an overlay, displaying the given beatmap.
|
||||
|
@ -14,6 +14,7 @@ using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Profile;
|
||||
using osu.Game.Overlays.Profile.Sections;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -38,10 +39,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override Color4 BackgroundColour => ColourProvider.Background6;
|
||||
|
||||
public void ShowUser(int userId) => ShowUser(new APIUser { Id = userId });
|
||||
|
||||
public void ShowUser(string username) => ShowUser(new APIUser { Username = username });
|
||||
|
||||
public void ShowUser(IUser user)
|
||||
{
|
||||
if (user == APIUser.SYSTEM_USER)
|
||||
@ -49,7 +46,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
Show();
|
||||
|
||||
if (user.Id == Header?.User.Value?.Id)
|
||||
if (user.OnlineID == Header?.User.Value?.Id)
|
||||
return;
|
||||
|
||||
if (sectionsContainer != null)
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Users.Drawables
|
||||
private void openProfile()
|
||||
{
|
||||
if (user?.Id > 1)
|
||||
game?.ShowUser(user.Id);
|
||||
game?.ShowUser(user);
|
||||
}
|
||||
|
||||
private class ClickableArea : OsuClickableContainer
|
||||
|
Loading…
Reference in New Issue
Block a user