osukey/osu.Game/Online/Spectator/FrameHeader.cs
2020-12-14 18:41:24 +09:00

43 lines
1.2 KiB
C#

// 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.
#nullable enable
using System;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Scoring;
namespace osu.Game.Online.Spectator
{
[Serializable]
public class FrameHeader
{
public int Combo { get; set; }
public int MaxCombo { get; set; }
public StatisticPair[] Statistics { get; set; }
/// <summary>
/// Construct header summary information from a point-in-time reference to a score which is actively being played.
/// </summary>
/// <param name="score">The score for reference.</param>
public FrameHeader(ScoreInfo score)
{
Combo = score.Combo;
MaxCombo = score.MaxCombo;
Statistics = score.Statistics.Select(kvp => new StatisticPair(kvp.Key, kvp.Value)).ToArray();
}
[JsonConstructor]
public FrameHeader(int combo, int maxCombo, StatisticPair[] statistics)
{
Combo = combo;
MaxCombo = maxCombo;
Statistics = statistics;
}
}
}