mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-15 08:05:06 +00:00
19 lines
No EOL
477 B
C#
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);
|
|
}
|
|
} |