Repository navigation
Add ranked play division badges - #38989
Conversation
Requires ppy/osu-resources#440. This PR adds components rendering both the full and compact variants of the badge displaying the user's division inside of ranked play. Also includes a proposed DTO for storing division metadata, which I hope will later be used when we get web to serve tier/division data to the client. I prefered doing this over implicitly assuming divisions start at 600, are spaced 100 ELO apart, etc. since the intention is to have this metadata served by web anyway.
| } | ||
|
|
||
| [JsonConverter(typeof(StringEnumConverter))] | ||
| public enum Tier |
There was a problem hiding this comment.
Would not put these in the same file as RankedPlayDivision. Maybe RankedPlayTier/RankedPlayDivision so that they're distinct from RankingTier (if we even want this to be separate in the first place).
There was a problem hiding this comment.
I completely missed RankingTier existing, will use that for now. Also will split out the division enum to a separate file and rename the model to APIRankedPlayDivision or something like that (is there a reason some response models have the API prefix and some don't?).
| new Sprite | ||
| { | ||
| Size = division.Tier switch | ||
| { | ||
| Tier.Bronze => new Vector2(33), | ||
| Tier.Silver => new Vector2(34.5f), | ||
| _ => new Vector2(36), | ||
| }, | ||
| Position = division.Tier switch | ||
| { | ||
| Tier.Bronze => new Vector2(43.5f, 24.75f), | ||
| Tier.Silver => new Vector2(42.75f, 27), | ||
| Tier.Gold => new Vector2(42, 23.25f), | ||
| Tier.Platinum => new Vector2(42, 28.5f), | ||
| Tier.Rhodium => new Vector2(42, 30), | ||
| Tier.Radiant => new Vector2(42, 33), | ||
| Tier.Lustrous => new Vector2(42, 43.5f), | ||
| _ => throw new ArgumentOutOfRangeException() | ||
| }, | ||
| Texture = textures.Get($@"Online/RankedPlay/Tiers/Rulesets/{ruleset.ShortName}"), | ||
| }, | ||
| new Sprite | ||
| { | ||
| RelativeSizeAxes = Axes.Both, | ||
| Texture = textures.Get($@"Online/RankedPlay/Tiers/Stars/{division.Key}"), | ||
| FillMode = FillMode.Fit, | ||
| }, |
There was a problem hiding this comment.
the shine layer will go above the stars but below the ruleset icon, so probably a good idea to swap the draw order these two
| [JsonProperty(@"key")] | ||
| public string Key = string.Empty; |
There was a problem hiding this comment.
Will this actually useful? Isn't it basically a concatenation of Tier and Division?
There was a problem hiding this comment.
I've split this out into a explicitly defined property since Lustrous doesn't have a division, and I wanted to avoid any ambiguity where some piece of code somewhere would forget to not concat anything to the end of Lustrous, causing bugs.
I can replace this with something like
public string Key => Tier == RankingTier.Lustrous
? Tier.ToString()
: $"{Tier}-{Division}";considering we're probably not changing the Lustrous name anytime soon.
(the same could probably go for DisplayName as well)
There was a problem hiding this comment.
I definitely prefer that to reduce the chance to make mistakes.
| [JsonProperty(@"start_rating")] | ||
| public int StartRating; | ||
|
|
||
| [JsonProperty("@end_rating")] |
There was a problem hiding this comment.
| [JsonProperty("@end_rating")] | |
| [JsonProperty(@"end_rating")] |
Requires ppy/osu-resources#440.
This PR adds components rendering both the full and compact variants of the badge displaying the user's division inside of ranked play.
Also includes a proposed DTO for storing division metadata, which I hope will later be used when we get web to serve tier/division data to the client. I prefered doing this over implicitly assuming divisions start at 600, are spaced 100 ELO apart, etc. since the intention is to have this metadata served by web anyway.
Regular badges:
Compact badges: