Seperate out the NetworkPacketDictonary
This commit is contained in:
1 parent
531fd2572f
commit
3992c3debc
6 files changed
+48
-46
No files matched your search
@@ -41,13 +41,8 @@ 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( resolvedType, DataLength, data );
|
||||
dynamic buildObj = DataPacket.Deserialize( dataType, DataLength, data );
|
||||
|
||||
// Return the object
|
||||
ClientInterface.ServerClientInstance.InvokeOnReceived( buildObj );
|
||||
|
||||
Reference in new issue
Block a user