mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Setup all spectator model classes for MessagePack
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Replays.Legacy;
|
||||
using osu.Game.Scoring;
|
||||
@ -12,10 +13,13 @@ using osu.Game.Scoring;
|
||||
namespace osu.Game.Online.Spectator
|
||||
{
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
public class FrameDataBundle
|
||||
{
|
||||
[Key(0)]
|
||||
public FrameHeader Header { get; set; }
|
||||
|
||||
[Key(1)]
|
||||
public IEnumerable<LegacyReplayFrame> Frames { get; set; }
|
||||
|
||||
public FrameDataBundle(ScoreInfo score, IEnumerable<LegacyReplayFrame> frames)
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
@ -12,31 +13,37 @@ using osu.Game.Scoring;
|
||||
namespace osu.Game.Online.Spectator
|
||||
{
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
public class FrameHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// The current accuracy of the score.
|
||||
/// </summary>
|
||||
[Key(0)]
|
||||
public double Accuracy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current combo of the score.
|
||||
/// </summary>
|
||||
[Key(1)]
|
||||
public int Combo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The maximum combo achieved up to the current point in time.
|
||||
/// </summary>
|
||||
[Key(2)]
|
||||
public int MaxCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cumulative hit statistics.
|
||||
/// </summary>
|
||||
[Key(3)]
|
||||
public Dictionary<HitResult, int> Statistics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time at which this frame was received by the server.
|
||||
/// </summary>
|
||||
[Key(4)]
|
||||
public DateTimeOffset ReceivedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -54,7 +61,8 @@ namespace osu.Game.Online.Spectator
|
||||
}
|
||||
|
||||
[JsonConstructor]
|
||||
public FrameHeader(int combo, int maxCombo, double accuracy, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime)
|
||||
[SerializationConstructor]
|
||||
public FrameHeader(double accuracy, int combo, int maxCombo, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime)
|
||||
{
|
||||
Combo = combo;
|
||||
MaxCombo = maxCombo;
|
||||
|
@ -5,18 +5,23 @@ 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<SpectatorState>
|
||||
{
|
||||
[Key(0)]
|
||||
public int? BeatmapID { get; set; }
|
||||
|
||||
[Key(1)]
|
||||
public int? RulesetID { get; set; }
|
||||
|
||||
[NotNull]
|
||||
[Key(2)]
|
||||
public IEnumerable<APIMod> Mods { get; set; } = Enumerable.Empty<APIMod>();
|
||||
|
||||
public bool Equals(SpectatorState other) => BeatmapID == other?.BeatmapID && Mods.SequenceEqual(other?.Mods) && RulesetID == other?.RulesetID;
|
||||
|
Reference in New Issue
Block a user