From 5f631a5a36b75ee57478afde4699eaf956cb54c2 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Wed, 30 Sep 2020 19:18:46 +0200 Subject: [PATCH] Add serialization for GameOptionsData (#31) --- .../Innersloth/GameOptionsData.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Impostor.Shared/Innersloth/GameOptionsData.cs b/src/Impostor.Shared/Innersloth/GameOptionsData.cs index 711edb1..4150a74 100644 --- a/src/Impostor.Shared/Innersloth/GameOptionsData.cs +++ b/src/Impostor.Shared/Innersloth/GameOptionsData.cs @@ -30,7 +30,33 @@ namespace Impostor.Shared.Innersloth public void Serialize(BinaryWriter writer, byte version) { - throw new NotImplementedException(); + writer.Write((byte) version); + writer.Write((byte) MaxPlayers); + writer.Write((uint) Keywords); + writer.Write((byte) MapId); + writer.Write((float) PlayerSpeedMod); + writer.Write((float) CrewLightMod); + writer.Write((float) ImpostorLightMod); + writer.Write((float) KillCooldown); + writer.Write((byte) NumCommonTasks); + writer.Write((byte) NumLongTasks); + writer.Write((byte) NumShortTasks); + writer.Write((int) NumEmergencyMeetings); + writer.Write((byte) NumImpostors); + writer.Write((byte) KillDistance); + writer.Write((uint) DiscussionTime); + writer.Write((uint) VotingTime); + writer.Write((bool) IsDefaults); + if (version > 1) + { + writer.Write((byte) EmergencyCooldown); + } + + if (version > 2) + { + writer.Write((bool) ConfirmImpostor); + writer.Write((bool) VisualTasks); + } } public static GameOptionsData Deserialize(byte[] bytes) -- 2.39.5