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