Display message name in ConnectionRecv log (#141)

This commit is contained in:
Paul Pacheco 2018-12-08 03:54:20 -06:00 committed by vis2k
parent 413d7cf474
commit 8ce2489df0

View File

@ -205,7 +205,19 @@ protected void HandleBytes(byte[] buffer)
byte[] content;
if (Protocol.UnpackMessage(buffer, out msgType, out content))
{
if (logNetworkMessages) { Debug.Log("ConnectionRecv con:" + connectionId + " msgType:" + msgType + " content:" + BitConverter.ToString(content)); }
if (logNetworkMessages)
{
if (Enum.IsDefined(typeof(MsgType), msgType))
{
// one of Mirror mesage types, display the message name
Debug.Log("ConnectionRecv con:" + connectionId + " msgType:" + (MsgType)msgType + " content:" + BitConverter.ToString(content));
}
else
{
// user defined message, display the number
Debug.Log("ConnectionRecv con:" + connectionId + " msgType:" + msgType + " content:" + BitConverter.ToString(content));
}
}
NetworkMessageDelegate msgDelegate;
if (m_MessageHandlers.TryGetValue((short)msgType, out msgDelegate))