quantum-space-buddies/QuantumUNET/QSBNetworkMessage.cs
2020-12-04 22:14:53 +00:00

25 lines
532 B
C#

using System;
namespace QuantumUNET
{
public class QSBNetworkMessage
{
public const int MaxMessageSize = 65535;
public short MsgType;
public QSBNetworkConnection Connection;
public QSBNetworkReader Reader;
public int ChannelId;
public TMsg ReadMessage<TMsg>() where TMsg : QSBMessageBase, new()
{
var result = Activator.CreateInstance<TMsg>();
result.Deserialize(Reader);
return result;
}
public void ReadMessage<TMsg>(TMsg msg) where TMsg : QSBMessageBase
{
msg.Deserialize(Reader);
}
}
}