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 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; } } }
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++; } } }
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; } } }
private bool SetupLocalPlayerForConnection(NetworkConnection conn, NetworkIdentity uv, PlayerController newPlayerController) { if (LogFilter.logDev) Debug.Log((object) ("NetworkServer SetupLocalPlayerForConnection netID:" + (object) uv.netId)); ULocalConnectionToClient connectionToClient = conn as ULocalConnectionToClient; if (connectionToClient == null) return false; if (LogFilter.logDev) Debug.Log((object) "NetworkServer AddPlayer handling ULocalConnectionToClient"); if (uv.netId.IsEmpty()) uv.OnStartServer(); uv.RebuildObservers(true); this.SendSpawnMessage(uv, (NetworkConnection) null); connectionToClient.localClient.AddLocalPlayer(newPlayerController); uv.SetLocalPlayer(newPlayerController.playerControllerId); return true; }