1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 12:42:56 +08:00
osu-lazer/osu.Game/Online/Spectator/SpectatorState.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.4 KiB
C#
Raw Normal View History

2020-10-22 18:41:10 +08:00
// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-10-22 16:29:38 +08:00
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using MessagePack;
2020-10-22 16:38:16 +08:00
using osu.Game.Online.API;
using osu.Game.Rulesets.Scoring;
2020-10-22 16:29:38 +08:00
namespace osu.Game.Online.Spectator
{
[Serializable]
[MessagePackObject]
2020-10-22 16:29:38 +08:00
public class SpectatorState : IEquatable<SpectatorState>
{
[Key(0)]
2020-10-22 16:29:38 +08:00
public int? BeatmapID { get; set; }
[Key(1)]
2020-10-23 16:24:19 +08:00
public int? RulesetID { get; set; }
2020-10-22 16:29:38 +08:00
[NotNull]
[Key(2)]
2020-10-22 16:38:16 +08:00
public IEnumerable<APIMod> Mods { get; set; } = Enumerable.Empty<APIMod>();
2020-10-22 16:29:38 +08:00
2022-02-01 14:51:41 +08:00
[Key(3)]
2022-02-09 11:09:04 +08:00
public SpectatedUserState State { get; set; }
2022-02-01 14:51:41 +08:00
[Key(4)]
public Dictionary<HitResult, int> MaximumStatistics { get; set; } = new Dictionary<HitResult, int>();
public bool Equals(SpectatorState other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
2022-02-01 14:51:41 +08:00
return BeatmapID == other.BeatmapID && Mods.SequenceEqual(other.Mods) && RulesetID == other.RulesetID && State == other.State;
}
2020-10-22 16:29:38 +08:00
2022-02-01 14:51:41 +08:00
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID} State:{State}";
2020-10-22 16:29:38 +08:00
}
}