private static void CheckForOwner(NetworkIdentity uv) { for (int i = 0; i < s_PendingOwnerIds.Count; i++) { PendingOwner owner = s_PendingOwnerIds[i]; if (owner.netId == uv.netId) { uv.SetConnectionToServer(s_ReadyConnection); uv.SetLocalPlayer(owner.playerControllerId); if (LogFilter.logDev) { Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name); } if (s_ReadyConnection.connectionId < 0) { if (LogFilter.logError) { Debug.LogError("Owner message received on a local client."); } } else { InternalAddPlayer(uv, owner.playerControllerId); s_PendingOwnerIds.RemoveAt(i); } break; } } }
static void CheckForOwner(NetworkIdentity uv) { for (int i = 0; i < s_PendingOwnerIds.Count; i++) { var pendingOwner = s_PendingOwnerIds[i]; if (pendingOwner.netId == uv.netId) { // found owner, turn into a local player // Set isLocalPlayer to true on this NetworkIdentity and trigger OnStartLocalPlayer in all scripts on the same GO uv.SetConnectionToServer(s_ReadyConnection); uv.SetLocalPlayer(pendingOwner.playerControllerId); if (LogFilter.logDev) { Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name); } if (s_ReadyConnection.connectionId < 0) { if (LogFilter.logError) { Debug.LogError("Owner message received on a local client."); } return; } InternalAddPlayer(uv, pendingOwner.playerControllerId); s_PendingOwnerIds.RemoveAt(i); break; } } }
private static void CheckForOwner(NetworkIdentity uv) { for (int index = 0; index < ClientScene.s_PendingOwnerIds.Count; ++index) { ClientScene.PendingOwner pendingOwnerId = ClientScene.s_PendingOwnerIds[index]; if (pendingOwnerId.netId == uv.netId) { uv.SetConnectionToServer(ClientScene.s_ReadyConnection); uv.SetLocalPlayer(pendingOwnerId.playerControllerId); if (LogFilter.logDev) { Debug.Log((object)("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name)); } if (ClientScene.s_ReadyConnection.connectionId < 0) { if (!LogFilter.logError) { break; } Debug.LogError((object)"Owner message received on a local client."); break; } ClientScene.InternalAddPlayer(uv, pendingOwnerId.playerControllerId); ClientScene.s_PendingOwnerIds.RemoveAt(index); break; } } }
private static void CheckForOwner(NetworkIdentity uv) { int i = 0; while (i < ClientScene.s_PendingOwnerIds.Count) { ClientScene.PendingOwner pendingOwner = ClientScene.s_PendingOwnerIds[i]; if (pendingOwner.netId == uv.netId) { uv.SetConnectionToServer(ClientScene.s_ReadyConnection); uv.SetLocalPlayer(pendingOwner.playerControllerId); if (LogFilter.logDev) { Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name); } if (ClientScene.s_ReadyConnection.connectionId < 0) { if (LogFilter.logError) { Debug.LogError("Owner message received on a local client."); } break; } ClientScene.InternalAddPlayer(uv, pendingOwner.playerControllerId); ClientScene.s_PendingOwnerIds.RemoveAt(i); break; } else { i++; } } }
internal void AddLocalPlayer(PlayerController localPlayer) { if (LogFilter.logDev) { Debug.Log((object)("Local client AddLocalPlayer " + localPlayer.gameObject.name + " conn=" + (object)this.m_Connection.connectionId)); } this.m_Connection.isReady = true; this.m_Connection.SetPlayerController(localPlayer); NetworkIdentity unetView = localPlayer.unetView; if ((Object)unetView != (Object)null) { ClientScene.SetLocalObject(unetView.netId, localPlayer.gameObject); unetView.SetConnectionToServer(this.m_Connection); } ClientScene.InternalAddPlayer(unetView, localPlayer.playerControllerId); }
internal void AddLocalPlayer(PlayerController localPlayer) { if (LogFilter.logDev) { Debug.Log(string.Concat(new object[] { "Local client AddLocalPlayer ", localPlayer.gameObject.name, " conn=", base.m_Connection.connectionId })); } base.m_Connection.isReady = true; base.m_Connection.SetPlayerController(localPlayer); NetworkIdentity unetView = localPlayer.unetView; if (unetView != null) { ClientScene.SetLocalObject(unetView.netId, localPlayer.gameObject); unetView.SetConnectionToServer(base.m_Connection); } ClientScene.InternalAddPlayer(unetView, localPlayer.playerControllerId); }
private static void CheckForOwner(NetworkIdentity uv) { int num = 0; PendingOwner pendingOwner; while (true) { if (num < s_PendingOwnerIds.Count) { pendingOwner = s_PendingOwnerIds[num]; if (pendingOwner.netId == uv.netId) { break; } num++; continue; } return; } uv.SetConnectionToServer(s_ReadyConnection); uv.SetLocalPlayer(pendingOwner.playerControllerId); if (LogFilter.logDev) { Debug.Log("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name); } if (s_ReadyConnection.connectionId < 0) { if (LogFilter.logError) { Debug.LogError("Owner message received on a local client."); } } else { InternalAddPlayer(uv, pendingOwner.playerControllerId); s_PendingOwnerIds.RemoveAt(num); } }
private static void CheckForOwner(NetworkIdentity uv) { for (int index = 0; index < ClientScene.s_PendingOwnerIds.Count; ++index) { ClientScene.PendingOwner pendingOwnerId = ClientScene.s_PendingOwnerIds[index]; if (pendingOwnerId.netId == uv.netId) { uv.SetConnectionToServer(ClientScene.s_ReadyConnection); uv.SetLocalPlayer(pendingOwnerId.playerControllerId); if (LogFilter.logDev) Debug.Log((object) ("ClientScene::OnOwnerMessage - player=" + uv.gameObject.name)); if (ClientScene.s_ReadyConnection.connectionId < 0) { if (!LogFilter.logError) break; Debug.LogError((object) "Owner message received on a local client."); break; } ClientScene.InternalAddPlayer(uv, pendingOwnerId.playerControllerId); ClientScene.s_PendingOwnerIds.RemoveAt(index); break; } } }