1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 10:53:21 +08:00

Clean up model

- Properly annotate things as nullable
- Remove weird passthrough property (more on that later)
This commit is contained in:
Bartłomiej Dach 2024-12-16 12:46:25 +09:00
parent e2edd9e0d5
commit 8d1d026f56
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View File

@ -4,6 +4,7 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -176,7 +177,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
if (variant.GlobalRank != null)
{
tooltipParts.Add($"{variant.VariantDisplay}: {variant.GlobalRank.ToLocalisableString("\\##,##0")}");
tooltipParts.Add($"{variant.VariantType.GetLocalisableDescription()}: {variant.GlobalRank.ToLocalisableString("\\##,##0")}");
}
}
}
@ -207,7 +208,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
if (variant.CountryRank != null)
{
countryTooltipParts.Add($"{variant.VariantDisplay}: {variant.CountryRank.Value.ToLocalisableString("\\##,##0")}");
countryTooltipParts.Add($"{variant.VariantType.GetLocalisableDescription()}: {variant.CountryRank.Value.ToLocalisableString("\\##,##0")}");
}
}
}

View File

@ -6,9 +6,9 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using osu.Framework.Extensions;
using osu.Framework.Localisation;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web;
@ -80,7 +80,8 @@ namespace osu.Game.Users
public Grades GradesCount;
[JsonProperty(@"variants")]
public List<Variant> Variants = null!;
[CanBeNull]
public List<Variant> Variants;
public struct Grades
{
@ -127,7 +128,7 @@ namespace osu.Game.Users
}
}
public enum GameVariant
public enum RulesetVariant
{
[EnumMember(Value = "4k")]
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.VariantMania4k))]
@ -154,9 +155,7 @@ namespace osu.Game.Users
[JsonProperty("variant")]
[JsonConverter(typeof(StringEnumConverter))]
public GameVariant? VariantType;
public LocalisableString VariantDisplay => VariantType?.GetLocalisableDescription() ?? string.Empty;
public RulesetVariant VariantType;
}
}
}