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:
parent
fa519984df
commit
c53f4c144c
@ -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),
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user