Add `UserProfile` model to be used in user profile overlay

As `APIUser` implements `IEquatable`, attempting to replace an `APIUser`
with another `APIUser` with the same online ID has no effect on the user
profile overlay. This is a significant hurdle in implementing support
for viewing the profile for different rulesets, as in that case the
profile is basically reloaded for the same user, but slightly different
data.

To facilitate this, wrap `APIUser` in a new `UserProfile` class. This
will mean that the equality rules can be changed locally to the user
profile overlay without impacting other components that depend on the
`APIUser` equality rules. The ruleset that the user profile is being
displayed with will eventually be added to `UserProfile`, too.
This commit is contained in:
Bartłomiej Dach 2022-12-30 12:13:44 +01:00
parent 53cc71c2fe
commit 608d8ee7d4
No known key found for this signature in database
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Profile
{
/// <summary>
/// Contains data about a profile presented on the <see cref="UserProfileOverlay"/>.
/// </summary>
public class UserProfile
{
/// <summary>
/// The user whose profile is being presented.
/// </summary>
public APIUser User { get; }
// TODO: add ruleset
public UserProfile(APIUser user)
{
User = user;
}
}
}