private void login_failed() { btn.interactable = true; remove_client_listeners(); client.Dispose(); client = null; }
private void on_click() { if (client != null) { return; } var name = Username.text; var pw = Password.text; if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(pw)) { Status.Error("Username and password required."); //TRANSLATE return; } Debug.Log("PW: " + pw); btn.interactable = false; client = new LoginClientLL(); client.OnDisconnected += on_disconnected; client.OnServerDisconnected += on_server_disconnected; client.OnLoginResult += on_login_result; client.DoLogin(name, pw); }
private void shut_down_services() { if (base_service != null) { base_service.Dispose(); base_service = null; } if (login_client != null) { login_client.Dispose(); login_client = null; } SceneManager.LoadScene("Login"); }
public void EstablishConnection(LoginClientLL login_service, RepeatedField <LoginServices.Server> servers) { Debug.Assert(servers.Count > 0); Debug.Assert(base_service == null, "A base service operation is already taking place..."); Debug.Assert(login_service == null, "Internal error. login service and base service always has to be in sync..."); login_service.OnDisconnected += on_login_client_disconnected; login_service.OnServerDisconnected += on_main_server_caused_disconnection; var selected_server_idx = MainThread <System.Random> .Get().Next(0, servers.Count - 1); selected_server = servers[selected_server_idx]; base_service = new BaseClientLL(new Channel(selected_server.Url, ChannelCredentials.Insecure)); //TODO: SSL, Compression base_service.OnDisconnected += on_base_server_disconnected; base_service.OnSuccessfulSubscription += on_successful_subscription; base_service.ConnectAsync(); }