Merge pull request #29404 from frenzibyte/fix-user-profile-ux

Fix user profile overlay colour resetting when selecting another ruleset
This commit is contained in:
Dan Balasescu 2024-08-13 20:00:57 +09:00 committed by GitHub
commit 3753f65139
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 4 deletions

View File

@ -11,6 +11,7 @@ using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Rulesets.Taiko;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Online
@ -192,13 +193,26 @@ namespace osu.Game.Tests.Visual.Online
int hue2 = 0;
AddSliderStep("hue 2", 0, 360, 50, h => hue2 = h);
AddStep("show user", () => profile.ShowUser(new APIUser { Id = 1 }));
AddStep("show user", () => profile.ShowUser(new APIUser { Id = 2 }));
AddWaitStep("wait some", 3);
AddStep("complete request", () => pendingRequest.TriggerSuccess(new APIUser
{
Username = $"Colorful #{hue2}",
Id = 1,
Id = 2,
CountryCode = CountryCode.JP,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg",
ProfileHue = hue2,
PlayMode = "osu",
}));
AddStep("show user different ruleset", () => profile.ShowUser(new APIUser { Id = 2 }, new TaikoRuleset().RulesetInfo));
AddWaitStep("wait some", 3);
AddStep("complete request", () => pendingRequest.TriggerSuccess(new APIUser
{
Username = $"Colorful #{hue2}",
Id = 2,
CountryCode = CountryCode.JP,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg",
ProfileHue = hue2,

View File

@ -96,7 +96,8 @@ namespace osu.Game.Overlays
{
Debug.Assert(user != null);
if (user.OnlineID == Header.User.Value?.User.Id && ruleset?.MatchesOnlineID(Header.User.Value?.Ruleset) == true)
bool sameUser = user.OnlineID == Header.User.Value?.User.Id;
if (sameUser && ruleset?.MatchesOnlineID(Header.User.Value?.Ruleset) == true)
return;
if (sectionsContainer != null)
@ -118,7 +119,9 @@ namespace osu.Game.Overlays
}
: Array.Empty<ProfileSection>();
changeOverlayColours(OverlayColourScheme.Pink.GetHue());
if (!sameUser)
changeOverlayColours(OverlayColourScheme.Pink.GetHue());
recreateBaseContent();
if (API.State.Value != APIState.Offline)