// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using System.Collections.Generic; using MessagePack; using Newtonsoft.Json; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Online.Spectator { [Serializable] [MessagePackObject] public class FrameHeader { /// /// The current accuracy of the score. /// [Key(0)] public double Accuracy { get; set; } /// /// The current combo of the score. /// [Key(1)] public int Combo { get; set; } /// /// The maximum combo achieved up to the current point in time. /// [Key(2)] public int MaxCombo { get; set; } /// /// Cumulative hit statistics. /// [Key(3)] public Dictionary Statistics { get; set; } /// /// The time at which this frame was received by the server. /// [Key(4)] public DateTimeOffset ReceivedTime { get; set; } /// /// Construct header summary information from a point-in-time reference to a score which is actively being played. /// /// The score for reference. public FrameHeader(ScoreInfo score) { Combo = score.Combo; MaxCombo = score.MaxCombo; Accuracy = score.Accuracy; // copy for safety Statistics = new Dictionary(score.Statistics); } [JsonConstructor] [SerializationConstructor] public FrameHeader(double accuracy, int combo, int maxCombo, Dictionary statistics, DateTimeOffset receivedTime) { Combo = combo; MaxCombo = maxCombo; Accuracy = accuracy; Statistics = statistics; ReceivedTime = receivedTime; } } }