From 306f974e0ccdd095295146d6d4c9ca8a1b57595f Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Wed, 30 Jan 2019 07:39:21 -0600 Subject: [PATCH] 4.x syntax --- Assets/Mirror/Runtime/NetworkManager.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkManager.cs b/Assets/Mirror/Runtime/NetworkManager.cs index ea89cea5b..4a3b72cdf 100644 --- a/Assets/Mirror/Runtime/NetworkManager.cs +++ b/Assets/Mirror/Runtime/NetworkManager.cs @@ -51,7 +51,7 @@ public class NetworkManager : MonoBehaviour public bool clientLoadedScene; // only really valid on the server - public int numPlayers { get { return NetworkServer.connections.Count(kv => kv.Value.playerController != null); } } + public int numPlayers => NetworkServer.connections.Count(kv => kv.Value.playerController != null); // runtime data public static string networkSceneName = ""; // this is used to make sure that all scene changes are initialized by UNET. loading a scene manually wont set networkSceneName, so UNET would still load it again on start. @@ -261,8 +261,10 @@ public NetworkClient StartClient(ushort hostPort=0) isNetworkActive = true; - client = new NetworkClient(); - client.hostPort = hostPort; + client = new NetworkClient + { + hostPort = hostPort + }; RegisterClientMessages(client); @@ -529,9 +531,11 @@ internal void OnServerAddPlayerMessageInternal(NetworkMessage netMsg) { // convert payload to extra message and call OnServerAddPlayer // (usually for character selection information) - NetworkMessage extraMessage = new NetworkMessage(); - extraMessage.reader = new NetworkReader(msg.value); - extraMessage.conn = netMsg.conn; + NetworkMessage extraMessage = new NetworkMessage + { + reader = new NetworkReader(msg.value), + conn = netMsg.conn + }; OnServerAddPlayer(netMsg.conn, extraMessage); } else