// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using MessagePack; using osu.Game.Online.API; namespace osu.Game.Online.Spectator { [Serializable] [MessagePackObject] public class SpectatorState : IEquatable { [Key(0)] public int? BeatmapID { get; set; } [Key(1)] public int? RulesetID { get; set; } [NotNull] [Key(2)] public IEnumerable Mods { get; set; } = Enumerable.Empty(); [Key(3)] public SpectatedUserState State { get; set; } /// /// The maximum achievable combo, if everything is hit perfectly. /// [Key(4)] public int MaxAchievableCombo { get; set; } /// /// The maximum achievable base score, if everything is hit perfectly. /// [Key(5)] public double MaxAchievableBaseScore { get; set; } /// /// The total number of basic (non-tick and non-bonus) hitobjects that can be hit. /// [Key(6)] public int TotalBasicHitObjects { get; set; } public bool Equals(SpectatorState other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return BeatmapID == other.BeatmapID && Mods.SequenceEqual(other.Mods) && RulesetID == other.RulesetID && State == other.State; } public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID} State:{State}"; } }