0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-12-01 07:33:07 +00:00
SmoOnlineServer/Shared/Packet/Packets/InitPacket.cs
2022-05-08 16:04:57 -06:00

19 lines
No EOL
477 B
C#

using System.Runtime.InteropServices;
namespace Shared.Packet.Packets;
[Packet(PacketType.Init)]
public struct InitPacket : IPacket {
public short Size { get; } = 2;
public ushort MaxPlayers = 0;
public InitPacket() { }
public void Serialize(Span<byte> data) {
MemoryMarshal.Write(data, ref MaxPlayers);
}
public void Deserialize(ReadOnlySpan<byte> data) {
MaxPlayers = MemoryMarshal.Read<ushort>(data);
}
}