1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Encode/decode new OnlineID into/from LegacyReplaySoloScoreInfo

This commit is contained in:
Bartłomiej Dach 2023-09-01 08:23:29 +02:00
parent fa519984df
commit c53f4c144c
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,13 @@ namespace osu.Game.Scoring.Legacy
[JsonObject(MemberSerialization.OptIn)]
public class LegacyReplaySoloScoreInfo
{
/// <remarks>
/// The value of this property should correspond to <see cref="ScoreInfo.OnlineID"/>
/// (i.e. come from the `solo_scores` ID scheme).
/// </remarks>
[JsonProperty("online_id")]
public long OnlineID { get; set; } = -1;
[JsonProperty("mods")]
public APIMod[] Mods { get; set; } = Array.Empty<APIMod>();
@ -30,6 +37,7 @@ namespace osu.Game.Scoring.Legacy
public static LegacyReplaySoloScoreInfo FromScore(ScoreInfo score) => new LegacyReplaySoloScoreInfo
{
OnlineID = score.OnlineID,
Mods = score.APIMods,
Statistics = score.Statistics.Where(kvp => kvp.Value != 0).ToDictionary(kvp => kvp.Key, kvp => kvp.Value),
MaximumStatistics = score.MaximumStatistics.Where(kvp => kvp.Value != 0).ToDictionary(kvp => kvp.Key, kvp => kvp.Value),

View File

@ -121,6 +121,7 @@ namespace osu.Game.Scoring.Legacy
Debug.Assert(readScore != null);
score.ScoreInfo.OnlineID = readScore.OnlineID;
score.ScoreInfo.Statistics = readScore.Statistics;
score.ScoreInfo.MaximumStatistics = readScore.MaximumStatistics;
score.ScoreInfo.Mods = readScore.Mods.Select(m => m.ToMod(currentRuleset)).ToArray();