diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs
index 243a100029..88766a608c 100644
--- a/osu.Game/Localisation/CommonStrings.cs
+++ b/osu.Game/Localisation/CommonStrings.cs
@@ -179,6 +179,16 @@ namespace osu.Game.Localisation
///
public static LocalisableString CopyLink => new TranslatableString(getKey(@"copy_link"), @"Copy link");
+ ///
+ /// "4K"
+ ///
+ public static LocalisableString FourKey => new TranslatableString(getKey(@"four_key"), @"4K");
+
+ ///
+ /// "7K"
+ ///
+ public static LocalisableString SevenKey => new TranslatableString(getKey(@"seven_key"), @"7K");
+
private static string getKey(string key) => $@"{prefix}:{key}";
}
-}
\ No newline at end of file
+}
diff --git a/osu.Game/Overlays/Profile/Header/Components/MainDetails.cs b/osu.Game/Overlays/Profile/Header/Components/MainDetails.cs
index 3d97082230..84919d18bb 100644
--- a/osu.Game/Overlays/Profile/Header/Components/MainDetails.cs
+++ b/osu.Game/Overlays/Profile/Header/Components/MainDetails.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
+using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.LocalisationExtensions;
@@ -164,13 +165,56 @@ namespace osu.Game.Overlays.Profile.Header.Components
detailGlobalRank.Content = user?.Statistics?.GlobalRank?.ToLocalisableString("\\##,##0") ?? (LocalisableString)"-";
var rankHighest = user?.RankHighest;
+ var variants = user?.Statistics.Variants;
- detailGlobalRank.ContentTooltipText = rankHighest != null
- ? UsersStrings.ShowRankHighest(rankHighest.Rank.ToLocalisableString("\\##,##0"), rankHighest.UpdatedAt.ToLocalisableString(@"d MMM yyyy"))
+ #region Global rank tooltip
+ var tooltipParts = new List();
+
+ if (variants?.Count > 0)
+ {
+ foreach (var variant in variants)
+ {
+ if (variant.GlobalRank != null)
+ {
+ tooltipParts.Add($"{variant.VariantDisplay}: {variant.GlobalRank.ToLocalisableString("\\##,##0")}");
+ }
+ }
+ }
+
+ if (rankHighest != null)
+ {
+ tooltipParts.Add(UsersStrings.ShowRankHighest(
+ rankHighest.Rank.ToLocalisableString("\\##,##0"),
+ rankHighest.UpdatedAt.ToLocalisableString(@"d MMM yyyy"))
+ );
+ }
+
+ detailGlobalRank.ContentTooltipText = tooltipParts.Any()
+ ? string.Join("\n", tooltipParts)
: string.Empty;
+ #endregion
detailCountryRank.Content = user?.Statistics?.CountryRank?.ToLocalisableString("\\##,##0") ?? (LocalisableString)"-";
+ #region Country rank tooltip
+ var countryTooltipParts = new List();
+
+ if (variants?.Count > 0)
+ {
+ foreach (var variant in variants)
+ {
+ if (variant.CountryRank != null)
+ {
+ countryTooltipParts.Add($"{variant.VariantDisplay}: {variant.CountryRank.Value.ToLocalisableString("\\##,##0")}");
+ }
+ }
+ }
+
+ detailCountryRank.ContentTooltipText = countryTooltipParts.Any()
+ ? string.Join("\n", countryTooltipParts)
+ : string.Empty;
+ #endregion
+
rankGraph.Statistics.Value = user?.Statistics;
}
diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs
index 918a1b6968..d18675198f 100644
--- a/osu.Game/Users/UserStatistics.cs
+++ b/osu.Game/Users/UserStatistics.cs
@@ -4,8 +4,12 @@
#nullable disable
using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
using osu.Framework.Localisation;
+using osu.Game.Localisation;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Scoring;
using osu.Game.Utils;
@@ -74,6 +78,9 @@ namespace osu.Game.Users
[JsonProperty(@"grade_counts")]
public Grades GradesCount;
+ [JsonProperty(@"variants")]
+ public List Variants = null!;
+
public struct Grades
{
[JsonProperty(@"ssh")]
@@ -118,5 +125,38 @@ namespace osu.Game.Users
}
}
}
+ public enum GameVariant
+ {
+ [EnumMember(Value = "4k")]
+ FourKey,
+ [EnumMember(Value = "7k")]
+ SevenKey
+ }
+
+ public class Variant
+ {
+ [JsonProperty("country_rank")]
+ public int? CountryRank;
+
+ [JsonProperty("global_rank")]
+ public int? GlobalRank;
+
+ [JsonProperty("mode")]
+ public string Mode;
+
+ [JsonProperty("pp")]
+ public decimal PP;
+
+ [JsonProperty("variant")]
+ [JsonConverter(typeof(StringEnumConverter))]
+ public GameVariant? VariantType;
+
+ public LocalisableString VariantDisplay => VariantType switch
+ {
+ GameVariant.FourKey => CommonStrings.FourKey,
+ GameVariant.SevenKey => CommonStrings.SevenKey,
+ _ => string.Empty
+ };
+ }
}
}