mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Made member accessor debug logs consistent. (#513)
This commit is contained in:
parent
1e13ef5c31
commit
5a9f10ec47
@ -203,7 +203,7 @@ public override void OnServerAddPlayer(NetworkConnection conn)
|
|||||||
|
|
||||||
allPlayersReady = false;
|
allPlayersReady = false;
|
||||||
|
|
||||||
if (LogFilter.Debug) Debug.LogFormat("NetworkLobbyManager:OnServerAddPlayer playerPrefab:{0}", lobbyPlayerPrefab.name);
|
if (LogFilter.Debug) Debug.LogFormat("NetworkLobbyManager.OnServerAddPlayer playerPrefab:{0}", lobbyPlayerPrefab.name);
|
||||||
|
|
||||||
GameObject newLobbyGameObject = OnLobbyServerCreateLobbyPlayer(conn);
|
GameObject newLobbyGameObject = OnLobbyServerCreateLobbyPlayer(conn);
|
||||||
if (newLobbyGameObject == null)
|
if (newLobbyGameObject == null)
|
||||||
|
@ -41,7 +41,7 @@ internal static void Shutdown()
|
|||||||
// this is called from message handler for Owner message
|
// this is called from message handler for Owner message
|
||||||
internal static void InternalAddPlayer(NetworkIdentity identity)
|
internal static void InternalAddPlayer(NetworkIdentity identity)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.LogWarning("ClientScene::InternalAddPlayer"); }
|
if (LogFilter.Debug) { Debug.LogWarning("ClientScene.InternalAddPlayer"); }
|
||||||
|
|
||||||
// NOTE: It can be "normal" when changing scenes for the player to be destroyed and recreated.
|
// NOTE: It can be "normal" when changing scenes for the player to be destroyed and recreated.
|
||||||
// But, the player structures are not cleaned up, we'll just replace the old player
|
// But, the player structures are not cleaned up, we'll just replace the old player
|
||||||
@ -81,11 +81,11 @@ public static bool AddPlayer(NetworkConnection readyConn, MessageBase extraMessa
|
|||||||
|
|
||||||
if (readyConnection.playerController != null)
|
if (readyConnection.playerController != null)
|
||||||
{
|
{
|
||||||
Debug.LogError("ClientScene::AddPlayer: a PlayerController was already added. Did you call AddPlayer twice?");
|
Debug.LogError("ClientScene.AddPlayer: a PlayerController was already added. Did you call AddPlayer twice?");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::AddPlayer() called with connection [" + readyConnection + "]"); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.AddPlayer() called with connection [" + readyConnection + "]"); }
|
||||||
|
|
||||||
AddPlayerMessage msg = new AddPlayerMessage();
|
AddPlayerMessage msg = new AddPlayerMessage();
|
||||||
if (extraMessage != null)
|
if (extraMessage != null)
|
||||||
@ -100,7 +100,7 @@ public static bool AddPlayer(NetworkConnection readyConn, MessageBase extraMessa
|
|||||||
|
|
||||||
public static bool RemovePlayer()
|
public static bool RemovePlayer()
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::RemovePlayer() called with connection [" + readyConnection + "]"); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.RemovePlayer() called with connection [" + readyConnection + "]"); }
|
||||||
|
|
||||||
if (readyConnection.playerController != null)
|
if (readyConnection.playerController != null)
|
||||||
{
|
{
|
||||||
@ -125,7 +125,7 @@ public static bool Ready(NetworkConnection conn)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::Ready() called with connection [" + conn + "]"); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.Ready() called with connection [" + conn + "]"); }
|
||||||
|
|
||||||
if (conn != null)
|
if (conn != null)
|
||||||
{
|
{
|
||||||
@ -491,7 +491,7 @@ internal static void OnObjectSpawnFinished(NetworkMessage netMsg)
|
|||||||
internal static void OnObjectDestroy(NetworkMessage netMsg)
|
internal static void OnObjectDestroy(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
ObjectDestroyMessage msg = netMsg.ReadMessage<ObjectDestroyMessage>();
|
ObjectDestroyMessage msg = netMsg.ReadMessage<ObjectDestroyMessage>();
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnObjDestroy netId:" + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnObjDestroy netId:" + msg.netId); }
|
||||||
|
|
||||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
||||||
{
|
{
|
||||||
@ -523,7 +523,7 @@ internal static void OnObjectDestroy(NetworkMessage netMsg)
|
|||||||
internal static void OnLocalClientObjectDestroy(NetworkMessage netMsg)
|
internal static void OnLocalClientObjectDestroy(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
ObjectDestroyMessage msg = netMsg.ReadMessage<ObjectDestroyMessage>();
|
ObjectDestroyMessage msg = netMsg.ReadMessage<ObjectDestroyMessage>();
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnLocalObjectObjDestroy netId:" + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnLocalObjectObjDestroy netId:" + msg.netId); }
|
||||||
|
|
||||||
NetworkIdentity.spawned.Remove(msg.netId);
|
NetworkIdentity.spawned.Remove(msg.netId);
|
||||||
}
|
}
|
||||||
@ -531,7 +531,7 @@ internal static void OnLocalClientObjectDestroy(NetworkMessage netMsg)
|
|||||||
internal static void OnLocalClientObjectHide(NetworkMessage netMsg)
|
internal static void OnLocalClientObjectHide(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
ObjectDestroyMessage msg = netMsg.ReadMessage<ObjectDestroyMessage>();
|
ObjectDestroyMessage msg = netMsg.ReadMessage<ObjectDestroyMessage>();
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnLocalObjectObjHide netId:" + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnLocalObjectObjHide netId:" + msg.netId); }
|
||||||
|
|
||||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
||||||
{
|
{
|
||||||
@ -563,7 +563,7 @@ internal static void OnUpdateVarsMessage(NetworkMessage netMsg)
|
|||||||
{
|
{
|
||||||
UpdateVarsMessage msg = netMsg.ReadMessage<UpdateVarsMessage>();
|
UpdateVarsMessage msg = netMsg.ReadMessage<UpdateVarsMessage>();
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnUpdateVarsMessage " + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnUpdateVarsMessage " + msg.netId); }
|
||||||
|
|
||||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
|
||||||
{
|
{
|
||||||
@ -579,7 +579,7 @@ internal static void OnRPCMessage(NetworkMessage netMsg)
|
|||||||
{
|
{
|
||||||
RpcMessage msg = netMsg.ReadMessage<RpcMessage>();
|
RpcMessage msg = netMsg.ReadMessage<RpcMessage>();
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnRPCMessage hash:" + msg.functionHash + " netId:" + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnRPCMessage hash:" + msg.functionHash + " netId:" + msg.netId); }
|
||||||
|
|
||||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
|
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
|
||||||
{
|
{
|
||||||
@ -591,7 +591,7 @@ internal static void OnSyncEventMessage(NetworkMessage netMsg)
|
|||||||
{
|
{
|
||||||
SyncEventMessage msg = netMsg.ReadMessage<SyncEventMessage>();
|
SyncEventMessage msg = netMsg.ReadMessage<SyncEventMessage>();
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnSyncEventMessage " + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnSyncEventMessage " + msg.netId); }
|
||||||
|
|
||||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
|
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
|
||||||
{
|
{
|
||||||
@ -607,7 +607,7 @@ internal static void OnClientAuthority(NetworkMessage netMsg)
|
|||||||
{
|
{
|
||||||
ClientAuthorityMessage msg = netMsg.ReadMessage<ClientAuthorityMessage>();
|
ClientAuthorityMessage msg = netMsg.ReadMessage<ClientAuthorityMessage>();
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnClientAuthority for connectionId=" + netMsg.conn.connectionId + " netId: " + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnClientAuthority for connectionId=" + netMsg.conn.connectionId + " netId: " + msg.netId); }
|
||||||
|
|
||||||
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
|
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
|
||||||
{
|
{
|
||||||
@ -620,7 +620,7 @@ internal static void OnOwnerMessage(NetworkMessage netMsg)
|
|||||||
{
|
{
|
||||||
OwnerMessage msg = netMsg.ReadMessage<OwnerMessage>();
|
OwnerMessage msg = netMsg.ReadMessage<OwnerMessage>();
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnOwnerMessage - connectionId=" + netMsg.conn.connectionId + " netId: " + msg.netId); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnOwnerMessage - connectionId=" + netMsg.conn.connectionId + " netId: " + msg.netId); }
|
||||||
|
|
||||||
// is there already an owner that is a different object??
|
// is there already an owner that is a different object??
|
||||||
netMsg.conn.playerController?.SetNotLocalPlayer();
|
netMsg.conn.playerController?.SetNotLocalPlayer();
|
||||||
@ -651,7 +651,7 @@ static void CheckForOwner(NetworkIdentity identity)
|
|||||||
identity.connectionToServer = readyConnection;
|
identity.connectionToServer = readyConnection;
|
||||||
identity.SetLocalPlayer();
|
identity.SetLocalPlayer();
|
||||||
|
|
||||||
if (LogFilter.Debug) { Debug.Log("ClientScene::OnOwnerMessage - player=" + identity.name); }
|
if (LogFilter.Debug) { Debug.Log("ClientScene.OnOwnerMessage - player=" + identity.name); }
|
||||||
if (readyConnection.connectionId < 0)
|
if (readyConnection.connectionId < 0)
|
||||||
{
|
{
|
||||||
Debug.LogError("Owner message received on a local client.");
|
Debug.LogError("Owner message received on a local client.");
|
||||||
|
@ -32,7 +32,7 @@ internal override bool SendBytes(byte[] bytes, int channelId = Channels.DefaultR
|
|||||||
{
|
{
|
||||||
if (bytes.Length == 0)
|
if (bytes.Length == 0)
|
||||||
{
|
{
|
||||||
Debug.LogError("LocalConnection:SendBytes cannot send zero bytes");
|
Debug.LogError("LocalConnection.SendBytes cannot send zero bytes");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,14 +140,14 @@ internal virtual bool SendBytes( byte[] bytes, int channelId = Channels.DefaultR
|
|||||||
|
|
||||||
if (bytes.Length > Transport.activeTransport.GetMaxPacketSize(channelId))
|
if (bytes.Length > Transport.activeTransport.GetMaxPacketSize(channelId))
|
||||||
{
|
{
|
||||||
Debug.LogError("NetworkConnection:SendBytes cannot send packet larger than " + Transport.activeTransport.GetMaxPacketSize(channelId) + " bytes");
|
Debug.LogError("NetworkConnection.SendBytes cannot send packet larger than " + Transport.activeTransport.GetMaxPacketSize(channelId) + " bytes");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes.Length == 0)
|
if (bytes.Length == 0)
|
||||||
{
|
{
|
||||||
// zero length packets getting into the packet queues are bad.
|
// zero length packets getting into the packet queues are bad.
|
||||||
Debug.LogError("NetworkConnection:SendBytes cannot send zero bytes");
|
Debug.LogError("NetworkConnection.SendBytes cannot send zero bytes");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ public static void Shutdown()
|
|||||||
|
|
||||||
internal void OnServerConnectInternal(NetworkMessage netMsg)
|
internal void OnServerConnectInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnServerConnectInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnServerConnectInternal"); }
|
||||||
|
|
||||||
if (networkSceneName != "" && networkSceneName != offlineScene)
|
if (networkSceneName != "" && networkSceneName != offlineScene)
|
||||||
{
|
{
|
||||||
@ -536,19 +536,19 @@ internal void OnServerConnectInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnServerDisconnectInternal(NetworkMessage netMsg)
|
internal void OnServerDisconnectInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnServerDisconnectInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnServerDisconnectInternal"); }
|
||||||
OnServerDisconnect(netMsg.conn);
|
OnServerDisconnect(netMsg.conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnServerReadyMessageInternal(NetworkMessage netMsg)
|
internal void OnServerReadyMessageInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnServerReadyMessageInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnServerReadyMessageInternal"); }
|
||||||
OnServerReady(netMsg.conn);
|
OnServerReady(netMsg.conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnServerAddPlayerMessageInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnServerAddPlayerMessageInternal"); }
|
||||||
|
|
||||||
AddPlayerMessage msg = netMsg.ReadMessage<AddPlayerMessage>();
|
AddPlayerMessage msg = netMsg.ReadMessage<AddPlayerMessage>();
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnServerRemovePlayerMessageInternal(NetworkMessage netMsg)
|
internal void OnServerRemovePlayerMessageInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnServerRemovePlayerMessageInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnServerRemovePlayerMessageInternal"); }
|
||||||
|
|
||||||
if (netMsg.conn.playerController != null)
|
if (netMsg.conn.playerController != null)
|
||||||
{
|
{
|
||||||
@ -582,7 +582,7 @@ internal void OnServerRemovePlayerMessageInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnServerErrorInternal(NetworkMessage netMsg)
|
internal void OnServerErrorInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnServerErrorInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnServerErrorInternal"); }
|
||||||
|
|
||||||
ErrorMessage msg = netMsg.ReadMessage<ErrorMessage>();
|
ErrorMessage msg = netMsg.ReadMessage<ErrorMessage>();
|
||||||
OnServerError(netMsg.conn, msg.value);
|
OnServerError(netMsg.conn, msg.value);
|
||||||
@ -592,7 +592,7 @@ internal void OnServerErrorInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnClientConnectInternal(NetworkMessage netMsg)
|
internal void OnClientConnectInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnClientConnectInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnClientConnectInternal"); }
|
||||||
|
|
||||||
string loadedSceneName = SceneManager.GetActiveScene().name;
|
string loadedSceneName = SceneManager.GetActiveScene().name;
|
||||||
if (string.IsNullOrEmpty(onlineScene) || onlineScene == offlineScene || loadedSceneName == onlineScene)
|
if (string.IsNullOrEmpty(onlineScene) || onlineScene == offlineScene || loadedSceneName == onlineScene)
|
||||||
@ -609,14 +609,14 @@ internal void OnClientConnectInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnClientDisconnectInternal(NetworkMessage netMsg)
|
internal void OnClientDisconnectInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnClientDisconnectInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnClientDisconnectInternal"); }
|
||||||
|
|
||||||
OnClientDisconnect(netMsg.conn);
|
OnClientDisconnect(netMsg.conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnClientNotReadyMessageInternal(NetworkMessage netMsg)
|
internal void OnClientNotReadyMessageInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnClientNotReadyMessageInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnClientNotReadyMessageInternal"); }
|
||||||
|
|
||||||
ClientScene.ready = false;
|
ClientScene.ready = false;
|
||||||
OnClientNotReady(netMsg.conn);
|
OnClientNotReady(netMsg.conn);
|
||||||
@ -626,7 +626,7 @@ internal void OnClientNotReadyMessageInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnClientErrorInternal(NetworkMessage netMsg)
|
internal void OnClientErrorInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnClientErrorInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnClientErrorInternal"); }
|
||||||
|
|
||||||
ErrorMessage msg = netMsg.ReadMessage<ErrorMessage>();
|
ErrorMessage msg = netMsg.ReadMessage<ErrorMessage>();
|
||||||
OnClientError(netMsg.conn, msg.value);
|
OnClientError(netMsg.conn, msg.value);
|
||||||
@ -634,7 +634,7 @@ internal void OnClientErrorInternal(NetworkMessage netMsg)
|
|||||||
|
|
||||||
internal void OnClientSceneInternal(NetworkMessage netMsg)
|
internal void OnClientSceneInternal(NetworkMessage netMsg)
|
||||||
{
|
{
|
||||||
if (LogFilter.Debug) { Debug.Log("NetworkManager:OnClientSceneInternal"); }
|
if (LogFilter.Debug) { Debug.Log("NetworkManager.OnClientSceneInternal"); }
|
||||||
|
|
||||||
string newSceneName = netMsg.reader.ReadString();
|
string newSceneName = netMsg.reader.ReadString();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user