diff options
author | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
commit | e9ea621b93fbb58d9edfca8375918791637bbd52 (patch) | |
tree | 19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Impostor-dev/src/Impostor.Api/Net/Messages/C2S |
+init
Diffstat (limited to 'Impostor-dev/src/Impostor.Api/Net/Messages/C2S')
7 files changed, 135 insertions, 0 deletions
diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message00HostGameC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message00HostGameC2S.cs new file mode 100644 index 0000000..4f5b39c --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message00HostGameC2S.cs @@ -0,0 +1,27 @@ +using System.IO; +using Impostor.Api.Innersloth; + +namespace Impostor.Api.Net.Messages.C2S +{ + public static class Message00HostGameC2S + { + public static void Serialize(IMessageWriter writer, GameOptionsData gameOptionsData) + { + writer.StartMessage(MessageFlags.HostGame); + + using (var memory = new MemoryStream()) + using (var writerBin = new BinaryWriter(memory)) + { + gameOptionsData.Serialize(writerBin, GameOptionsData.LatestVersion); + writer.WriteBytesAndSize(memory.ToArray()); + } + + writer.EndMessage(); + } + + public static GameOptionsData Deserialize(IMessageReader reader) + { + return GameOptionsData.DeserializeCreate(reader); + } + } +}
\ No newline at end of file diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message01JoinGameC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message01JoinGameC2S.cs new file mode 100644 index 0000000..f121b97 --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message01JoinGameC2S.cs @@ -0,0 +1,20 @@ +using System; + +namespace Impostor.Api.Net.Messages.C2S +{ + public static class Message01JoinGameC2S + { + public static void Serialize(IMessageWriter writer) + { + throw new System.NotImplementedException(); + } + + public static void Deserialize(IMessageReader reader, out int gameCode, out byte unknown) + { + var slice = reader.ReadBytes(sizeof(Int32) + sizeof(byte)).Span; + + gameCode = slice.ReadInt32(); + unknown = slice.ReadByte(); + } + } +}
\ No newline at end of file diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message04RemovePlayerC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message04RemovePlayerC2S.cs new file mode 100644 index 0000000..99cdcfa --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message04RemovePlayerC2S.cs @@ -0,0 +1,16 @@ +namespace Impostor.Api.Net.Messages.C2S +{ + public class Message04RemovePlayerC2S + { + public static void Serialize(IMessageWriter writer) + { + throw new System.NotImplementedException(); + } + + public static void Deserialize(IMessageReader reader, out int playerId, out byte reason) + { + playerId = reader.ReadPackedInt32(); + reason = reader.ReadByte(); + } + } +}
\ No newline at end of file diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message08EndGameC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message08EndGameC2S.cs new file mode 100644 index 0000000..7ca5e3a --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message08EndGameC2S.cs @@ -0,0 +1,18 @@ +using Impostor.Api.Innersloth; + +namespace Impostor.Api.Net.Messages.C2S +{ + public class Message08EndGameC2S + { + public static void Serialize(IMessageWriter writer) + { + throw new System.NotImplementedException(); + } + + public static void Deserialize(IMessageReader reader, out GameOverReason gameOverReason) + { + gameOverReason = (GameOverReason)reader.ReadByte(); + reader.ReadBoolean(); // showAd + } + } +}
\ No newline at end of file diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message10AlterGameC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message10AlterGameC2S.cs new file mode 100644 index 0000000..330f3b5 --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message10AlterGameC2S.cs @@ -0,0 +1,20 @@ +using Impostor.Api.Innersloth; + +namespace Impostor.Api.Net.Messages.C2S +{ + public class Message10AlterGameC2S + { + public static void Serialize(IMessageWriter writer) + { + throw new System.NotImplementedException(); + } + + public static void Deserialize(IMessageReader reader, out AlterGameTags gameTag, out bool isPublic) + { + var slice = reader.ReadBytes(sizeof(byte) + sizeof(byte)).Span; + + gameTag = (AlterGameTags)slice.ReadByte(); + isPublic = slice.ReadBoolean(); + } + } +}
\ No newline at end of file diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message11KickPlayerC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message11KickPlayerC2S.cs new file mode 100644 index 0000000..7c5b8b9 --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message11KickPlayerC2S.cs @@ -0,0 +1,16 @@ +namespace Impostor.Api.Net.Messages.C2S +{ + public class Message11KickPlayerC2S + { + public static void Serialize(IMessageWriter writer) + { + throw new System.NotImplementedException(); + } + + public static void Deserialize(IMessageReader reader, out int playerId, out bool isBan) + { + playerId = reader.ReadPackedInt32(); + isBan = reader.ReadBoolean(); + } + } +}
\ No newline at end of file diff --git a/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message16GetGameListC2S.cs b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message16GetGameListC2S.cs new file mode 100644 index 0000000..2b7e12a --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Net/Messages/C2S/Message16GetGameListC2S.cs @@ -0,0 +1,18 @@ +using Impostor.Api.Innersloth; + +namespace Impostor.Api.Net.Messages.C2S +{ + public class Message16GetGameListC2S + { + public static void Serialize(IMessageWriter writer) + { + throw new System.NotImplementedException(); + } + + public static void Deserialize(IMessageReader reader, out GameOptionsData options) + { + reader.ReadPackedInt32(); // Hardcoded 0. + options = GameOptionsData.DeserializeCreate(reader); + } + } +}
\ No newline at end of file |