mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-25 04:35:18 +00:00
19 lines
477 B
C#
19 lines
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);
|
|||
|
}
|
|||
|
}
|