Split apart the server packets from the client packets
This commit is contained in:
1 parent
ca39e184ed
commit
392a33eb9e
5 files changed
+38
-12
No files matched your search
@@ -41,8 +41,13 @@ namespace Mistox.Client {
|
||||
ushort DataLength = (ushort)((dataPacket[1] << 8) | dataPacket[2]);
|
||||
ReadOnlyMemory<byte> data = dataMemory.Slice(DataPacket.HeaderLength, DataLength);
|
||||
|
||||
// Get the type from the tag
|
||||
if (!DataPacket.ClientToClientPackets.TryGetValue(dataType, out Type resolvedType)) {
|
||||
throw new Exception($"Unknown packet type ID: {dataType}");
|
||||
}
|
||||
|
||||
// Extract the object
|
||||
dynamic buildObj = DataPacket.Deserialize( dataType, DataLength, data );
|
||||
dynamic buildObj = DataPacket.Deserialize( resolvedType, DataLength, data );
|
||||
|
||||
// Return the object
|
||||
ClientInterface.ServerClientInstance.InvokeOnReceived( buildObj );
|
||||
|
||||
Reference in new issue
Block a user