-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2064fc8
commit 6763bfa
Showing
5 changed files
with
25 additions
and
20 deletions.
There are no files selected for viewing
13 changes: 7 additions & 6 deletions
13
BeatTogether.DedicatedServer.Messaging/Abstractions/BaseRpcPacket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
using BeatTogether.LiteNetLib.Abstractions; | ||
using BeatTogether.Extensions; | ||
using BeatTogether.LiteNetLib.Abstractions; | ||
using BeatTogether.LiteNetLib.Util; | ||
|
||
namespace BeatTogether.DedicatedServer.Messaging.Abstractions | ||
{ | ||
public abstract class BaseRpcPacket : INetSerializable | ||
{ | ||
public float SyncTime { get; set; } | ||
public long SyncTime { get; set; } | ||
|
||
public virtual void ReadFrom(ref SpanBuffer reader) | ||
{ | ||
SyncTime = reader.ReadFloat32(); | ||
SyncTime = (long)reader.ReadVarULong(); | ||
} | ||
|
||
public virtual void WriteTo(ref SpanBuffer writer) | ||
{ | ||
writer.WriteFloat32(SyncTime); | ||
writer.WriteVarULong((ulong)SyncTime); | ||
} | ||
public virtual void ReadFrom(ref MemoryBuffer reader) | ||
{ | ||
SyncTime = reader.ReadFloat32(); | ||
SyncTime = (long)reader.ReadVarULong(); | ||
} | ||
|
||
public virtual void WriteTo(ref MemoryBuffer writer) | ||
{ | ||
writer.WriteFloat32(SyncTime); | ||
writer.WriteVarULong((ulong)SyncTime); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
using BeatTogether.LiteNetLib.Abstractions; | ||
using BeatTogether.Extensions; | ||
using BeatTogether.LiteNetLib.Abstractions; | ||
using BeatTogether.LiteNetLib.Util; | ||
|
||
namespace BeatTogether.DedicatedServer.Messaging.Packets | ||
{ | ||
public sealed class PingPacket : INetSerializable | ||
{ | ||
public float PingTime { get; set; } | ||
public long PingTime { get; set; } | ||
|
||
public void WriteTo(ref SpanBuffer writer) | ||
{ | ||
writer.WriteFloat32(PingTime); | ||
writer.WriteVarULong((ulong)PingTime); | ||
} | ||
|
||
public void ReadFrom(ref SpanBuffer reader) | ||
{ | ||
PingTime = reader.ReadFloat32(); | ||
PingTime = (long)reader.ReadVarULong(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
using BeatTogether.LiteNetLib.Abstractions; | ||
using BeatTogether.Extensions; | ||
using BeatTogether.LiteNetLib.Abstractions; | ||
using BeatTogether.LiteNetLib.Util; | ||
|
||
namespace BeatTogether.DedicatedServer.Messaging.Packets | ||
{ | ||
public sealed class PongPacket : INetSerializable | ||
{ | ||
public float PingTime { get; set; } | ||
public long PingTime { get; set; } | ||
|
||
public void WriteTo(ref SpanBuffer writer) | ||
{ | ||
writer.WriteFloat32(PingTime); | ||
writer.WriteVarULong((ulong)PingTime); | ||
} | ||
|
||
public void ReadFrom(ref SpanBuffer reader) | ||
{ | ||
PingTime = reader.ReadFloat32(); | ||
PingTime = (long)reader.ReadVarULong(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters