From 608d8ee7d40bc52370bd116401b23741715d505e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 30 Dec 2022 12:13:44 +0100 Subject: [PATCH] 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. --- osu.Game/Overlays/Profile/UserProfile.cs | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 osu.Game/Overlays/Profile/UserProfile.cs diff --git a/osu.Game/Overlays/Profile/UserProfile.cs b/osu.Game/Overlays/Profile/UserProfile.cs new file mode 100644 index 0000000000..12a469ddf9 --- /dev/null +++ b/osu.Game/Overlays/Profile/UserProfile.cs @@ -0,0 +1,25 @@ +// Copyright (c) ppy Pty Ltd . 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 +{ + /// + /// Contains data about a profile presented on the . + /// + public class UserProfile + { + /// + /// The user whose profile is being presented. + /// + public APIUser User { get; } + + // TODO: add ruleset + + public UserProfile(APIUser user) + { + User = user; + } + } +}