quantum-space-buddies/QuantumUNET/Messages/QNetworkMessage.cs
2020-12-23 12:58:45 +00:00

23 lines
512 B
C#

using QuantumUNET.Transport;
using System;
namespace QuantumUNET.Messages
{
public class QNetworkMessage
{
public short MsgType;
public QNetworkConnection Connection;
public QNetworkReader Reader;
public int ChannelId;
public TMsg ReadMessage<TMsg>() where TMsg : QMessageBase, new()
{
var result = Activator.CreateInstance<TMsg>();
result.Deserialize(Reader);
return result;
}
public void ReadMessage<TMsg>(TMsg msg) where TMsg : QMessageBase =>
msg.Deserialize(Reader);
}
}