From 4bc0711a9dc9e268679b97a015f4e0794bbad576 Mon Sep 17 00:00:00 2001 From: vis2k Date: Mon, 11 Jun 2018 10:52:43 +0200 Subject: [PATCH] NetworkClient: syntax improvements to simplify code --- .../Runtime/NetworkClient.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Unity-Technologies-networking/Runtime/NetworkClient.cs b/Unity-Technologies-networking/Runtime/NetworkClient.cs index 47b1a8808..73e1b7b78 100644 --- a/Unity-Technologies-networking/Runtime/NetworkClient.cs +++ b/Unity-Technologies-networking/Runtime/NetworkClient.cs @@ -93,10 +93,7 @@ public int hostPort public bool isConnected { get { return m_AsyncConnect == ConnectState.Connected; }} - public Type networkConnectionClass - { - get { return m_NetworkConnectionClass; } - } + public Type networkConnectionClass { get { return m_NetworkConnectionClass; } } public void SetNetworkConnectionClass() where T : NetworkConnection { @@ -306,7 +303,7 @@ public void Connect(string serverIp, int serverPort) string hostnameOrIp = serverIp; m_ServerPort = serverPort; - if (UnityEngine.Application.platform == RuntimePlatform.WebGLPlayer) + if (Application.platform == RuntimePlatform.WebGLPlayer) { m_ServerIp = hostnameOrIp; m_AsyncConnect = ConnectState.Resolved; @@ -415,11 +412,7 @@ void PrepareForConnect(bool usePlatformSpecificProtocols) if (m_UseSimulator) { - int minTimeout = (m_SimulatedLatency / 3) - 1; - if (minTimeout < 1) - { - minTimeout = 1; - } + int minTimeout = Mathf.Max((m_SimulatedLatency / 3) - 1, 1); int maxTimeout = m_SimulatedLatency * 3; if (LogFilter.logDebug) { Debug.Log("AddHost Using Simulator " + minTimeout + "/" + maxTimeout); } @@ -465,11 +458,7 @@ internal void ContinueConnect() // regular non-relay connect if (m_UseSimulator) { - int simLatency = m_SimulatedLatency / 3; - if (simLatency < 1) - { - simLatency = 1; - } + int simLatency = Mathf.Max(m_SimulatedLatency / 3, 1); if (LogFilter.logDebug) { Debug.Log("Connect Using Simulator " + (m_SimulatedLatency / 3) + "/" + m_SimulatedLatency); } var simConfig = new ConnectionSimulatorConfig(