Skip to content

Commit

Permalink
Update NodePose- and ScoreSyncStatePacket float to long
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-r-elp committed Dec 21, 2023
1 parent 9b588a5 commit 5374038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ namespace BeatTogether.DedicatedServer.Messaging.Packets.MultiplayerSession
public sealed class NodePoseSyncStatePacket : INetSerializable
{
public byte SyncStateId { get; set; }
public float Time { get; set; }
public long Time { get; set; }
public NodePoseSyncState State { get; set; } = new();

public void ReadFrom(ref SpanBuffer reader)
{
SyncStateId = reader.ReadUInt8();
Time = reader.ReadFloat32();
Time = (long)reader.ReadVarULong();
State.ReadFrom(ref reader);
}

public void WriteTo(ref SpanBuffer writer)
{
writer.WriteUInt8(SyncStateId);
writer.WriteFloat32(Time);
writer.WriteVarULong((ulong)Time);
State.WriteTo(ref writer);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BeatTogether.DedicatedServer.Messaging.Models;
using BeatTogether.Extensions;
using BeatTogether.LiteNetLib.Abstractions;
using BeatTogether.LiteNetLib.Util;

Expand All @@ -7,20 +8,20 @@ namespace BeatTogether.DedicatedServer.Messaging.Packets.MultiplayerSession
public sealed class ScoreSyncStatePacket : INetSerializable
{
public byte SyncStateId { get; set; }
public float Time { get; set; }
public long Time { get; set; }
public StandardScoreSyncState State { get; set; } = new();

public void ReadFrom(ref SpanBuffer reader)
{
SyncStateId = reader.ReadUInt8();
Time = reader.ReadFloat32();
Time = (long)reader.ReadVarULong();
State.ReadFrom(ref reader);
}

public void WriteTo(ref SpanBuffer writer)
{
writer.WriteUInt8(SyncStateId);
writer.WriteFloat32(Time);
writer.WriteVarULong((ulong)Time);
State.WriteTo(ref writer);
}
}
Expand Down

0 comments on commit 5374038

Please sign in to comment.