0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-25 04:35:18 +00:00
SmoOnlineServer/Shared/Packet/Packets/InitPacket.cs

19 lines
477 B
C#
Raw Normal View History

2022-05-08 22:04:57 +00:00
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);
}
}