IEnumerator TryConnectToServer(LoginPanel.ServerTypes serverType) { while (true) { if (Client.Instance.Proxy.Socket == null || !Client.Instance.Proxy.Socket.Connected) { Connect(ServerIPDict[serverType], 9999, ConnectCallBack, null); } CheckConnectState(); yield return(new WaitForSeconds(2f)); } }
public void ConnectToServer(LoginPanel.ServerTypes serverType) { TerminateConnection(); CurrentTryConnectServer = StartCoroutine(TryConnectToServer(serverType)); }