mirror of https://github.com/ppy/osu
Change frame header to use dictionary for compatibility
This commit is contained in:
parent
88b3bf06e8
commit
84a0770789
|
@ -4,8 +4,9 @@
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Online.Spectator
|
namespace osu.Game.Online.Spectator
|
||||||
|
@ -17,7 +18,7 @@ public class FrameHeader
|
||||||
|
|
||||||
public int MaxCombo { get; set; }
|
public int MaxCombo { get; set; }
|
||||||
|
|
||||||
public StatisticPair[] Statistics { get; set; }
|
public Dictionary<HitResult, int> Statistics { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct header summary information from a point-in-time reference to a score which is actively being played.
|
/// Construct header summary information from a point-in-time reference to a score which is actively being played.
|
||||||
|
@ -28,11 +29,12 @@ public FrameHeader(ScoreInfo score)
|
||||||
Combo = score.Combo;
|
Combo = score.Combo;
|
||||||
MaxCombo = score.MaxCombo;
|
MaxCombo = score.MaxCombo;
|
||||||
|
|
||||||
Statistics = score.Statistics.Select(kvp => new StatisticPair(kvp.Key, kvp.Value)).ToArray();
|
// copy for safety
|
||||||
|
Statistics = new Dictionary<HitResult, int>(score.Statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public FrameHeader(int combo, int maxCombo, StatisticPair[] statistics)
|
public FrameHeader(int combo, int maxCombo, Dictionary<HitResult, int> statistics)
|
||||||
{
|
{
|
||||||
Combo = combo;
|
Combo = combo;
|
||||||
MaxCombo = maxCombo;
|
MaxCombo = maxCombo;
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Spectator
|
|
||||||
{
|
|
||||||
[Serializable]
|
|
||||||
public struct StatisticPair
|
|
||||||
{
|
|
||||||
public HitResult Result;
|
|
||||||
public int Count;
|
|
||||||
|
|
||||||
public StatisticPair(HitResult result, int count)
|
|
||||||
{
|
|
||||||
Result = result;
|
|
||||||
Count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() => $"{Result}=>{Count}";
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue