public void JoinLobby() { string username = GameObject.Find("UsernameInput").GetComponent <InputField>().text; string ipaddress = GameObject.Find("IpAddressInput").GetComponent <InputField>().text; if (username == "" || ipaddress == "") { // komunikat o bledzie formularza ErrorFormWindow.SetActive(true); return; } // auth request var authData = new AuthData() { LobbyId = "DEFAULT", Login = username, LobbyPassword = "" }; var clientSocket = new ClientSocket(ipaddress); string status = null; try { var authRequest = clientSocket.SendRequest(authData.GetApiObject()); while (authRequest.RequestState != RequestState.RESPONSE_RECEIVED) { clientSocket.UpdateCommunication(); } status = authRequest.ResponseData["status"].Value <string>(); } catch (Exception ex) { // w przypadku gdy nas nie zautoryzuje to nawet nie probujemy pobierac danych stolu bo nie ma po co using (StreamWriter outputFile = new StreamWriter("log.txt")) { outputFile.WriteLine(ex.Message); outputFile.WriteLine(ex.StackTrace); } ErrorWindow.SetActive(true); return; } if (status != "OK") { using (StreamWriter outputFile = new StreamWriter("log.txt")) { outputFile.WriteLine("wut"); } ErrorWindow.SetActive(true); } else { UserData.LoggedIn = true; UserData.ClientConnection = clientSocket; UserData.Username = username; SceneManager.LoadScene("Gameplay"); } }