feat: integrate previous usernames tooltip to profile overlay

This commit is contained in:
tsrk. 2023-09-11 15:02:19 +02:00
parent 200b3f87ff
commit 8c137353b6
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6
2 changed files with 40 additions and 0 deletions

View File

@ -110,5 +110,31 @@ namespace osu.Game.Tests.Visual.Online
}
}, new OsuRuleset().RulesetInfo));
}
[Test]
public void TestPreviousUsernames()
{
AddStep("Show user w/ previous usernames", () => header.User.Value = new UserProfileData(new APIUser
{
Id = 727,
Username = "SomeoneIndecisive",
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
Groups = new[]
{
new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" },
},
Statistics = new UserStatistics
{
IsRanked = false,
// web will sometimes return non-empty rank history even for unranked users.
RankHistory = new APIRankHistory
{
Mode = @"osu",
Data = Enumerable.Range(2345, 85).ToArray()
},
},
PreviousUsernames = new[] { "tsrk.", "quoicoubeh", "apagnan", "epita" }
}, new OsuRuleset().RulesetInfo));
}
}
}

View File

@ -46,6 +46,7 @@ namespace osu.Game.Overlays.Profile.Header
private OsuSpriteText userCountryText = null!;
private GroupBadgeFlow groupBadgeFlow = null!;
private ToggleCoverButton coverToggle = null!;
private PreviousUsernames previousUsernames = null!;
private Bindable<bool> coverExpanded = null!;
@ -143,6 +144,18 @@ namespace osu.Game.Overlays.Profile.Header
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new Container
{
Child = previousUsernames = new PreviousUsernames
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
},
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Size = new Vector2(0),
Position = new Vector2(10)
}
}
},
titleText = new OsuSpriteText
@ -216,6 +229,7 @@ namespace osu.Game.Overlays.Profile.Header
titleText.Text = user?.Title ?? string.Empty;
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");
groupBadgeFlow.User.Value = user;
previousUsernames.User.Value = user;
}
private void updateCoverState()