public void Connect() { Debug.Log("Connect"); if (smartFox == null || !smartFox.IsConnected) { // Set connection parameters ConfigData cfg = new ConfigData(); cfg.Host = SCG_Host; #if !UNITY_WEBGL cfg.Port = Convert.ToInt32(SCG_TcpPort); #else cfg.Port = Convert.ToInt32(SCG_WsPort); #endif cfg.Zone = SCG_Zone; cfg.Debug = true; // Connect to SFS2X smartFox.Connect(cfg); } else { // DISCONNECT // Disconnect from SFS2X smartFox.Disconnect(); } }
private void OnLoginError(BaseEvent evt) { var message = (string)evt.Params["errorMessage"]; GD.Print($"Login error; message={message}"); _sfs.Disconnect(); }
void OnApplicationQuit() { if (SfsReady) { sfs.Disconnect(); print("Disconnected"); } }
void OnApplicationQuit() { // Always disconnect before quitting if (sfs != null && sfs.IsConnected) { sfs.Disconnect(); } }
private void OnLoginError(BaseEvent evt) { // Disconnect sfs.Disconnect(); // Remove SFS2X listeners and re-enable interface reset(); // Show error message Debug.Log("Login failed: " + (string)evt.Params["errorMessage"]); }
} //end //-----------------------------------------------------------------------ON Button Clicked public void OnLogOutButtonClicked() { //on logoutbuton clicked this function called // Disconnect from server if (sfs != null && sfs.IsConnected) { sfs.Disconnect(); } logount.gameObject.SetActive(false); //close confirn logount form Home.gameObject.SetActive(true); //open home page AdminView.gameObject.SetActive(false); //close admin view page MemberView.gameObject.SetActive(false); //closme member view page }
} //end //-----------------------------------------------------------------------ON Button Clicked public void OnLogOutButtonClicked() { // Disconnect from server if (sfs != null && sfs.IsConnected) { sfs.Disconnect(); } logount.gameObject.SetActive(false); Home.gameObject.SetActive(true); // AdminView.gameObject.SetActive(false); // MemberView.gameObject.SetActive(false); }
// Handle disconnection automagically // ** Important for Windows users - can cause crashes otherwise void OnApplicationQuit() { if (smartFox != null && smartFox.IsConnected) { smartFox.Disconnect(); } }
private void OnLoginError(BaseEvent evt) { // Disconnect sfs.Disconnect(); // Remove SFS2X listeners and re-enable interface reset(); // Show error message errorText.text = "Login failed: " + (string)evt.Params["errorMessage"]; if (task == LOGIN.FACEBOOK) { task = LOGIN.DOREGISTERFBINFO; Login(); } }
private void OnApplicationQuit() { if (smartFox.IsConnected) { smartFox.Disconnect(); } }
void OnLoginError(BaseEvent evt) { popup.Show("ERROR IN GUEST LOGIN", "Something went wrong while we tried to login you as a guest, please try again.", true, 0, popup.Hide); Debug.Log("Login error: " + evt.Params["errorMessage"] + " - Code: " + evt.Params["errorCode"]); sfs.Disconnect(); }
/** * Disconnect from the socket when shutting down the game */ public void OnApplicationQuit() { if (sfs != null) { sfs.Disconnect(); } }
// Handle disconnection automagically // ** Important for Windows users - can cause crashes otherwise void OnApplicationQuit() { if (sfs.IsConnected) { sfs.Disconnect(); } }
// Handle disconnection // ** Important for Windows users - can cause crashes otherwise void OnApplicationQuit() { if (SFServer.IsConnected) { SFServer.Disconnect(); } }
protected void OnApplicationQuit() { if (smartFox.IsConnected) { UnregisterSFSSceneCallbacks(); smartFox.Disconnect(); } }
void OnApplicationQuit() { RemoveLocalPlayer(); if (sfs.IsConnected) { sfs.Disconnect(); } }
void OnDestroy() { //关闭时,断开与服务器连接 if (sfs != null && sfs.IsConnected) { sfs.Disconnect(); } }
IEnumerator coroutineDisconect() { sfs.Disconnect(); while (sfs.IsConnected) { yield return(new WaitForEndOfFrame()); } Application.Quit(); }
void OnApplicationQuit() { if (_smartFox.IsConnected) { Debug.Log("Quit..."); _smartFox.RemoveAllEventListeners(); _smartFox.Disconnect(); } }
public static void Connect(string uname) { if (sfs == null || !sfs.IsConnected) { username = uname; // CONNECT Debug.Log("Now connecting..."); // Add listeners sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection); sfs.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost); sfs.AddEventListener(SFSEvent.LOGIN, OnLogin); sfs.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError); sfs.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse); sfs.AddLogListener(LogLevel.INFO, OnInfoMessage); sfs.AddLogListener(LogLevel.WARN, OnWarnMessage); sfs.AddLogListener(LogLevel.ERROR, OnErrorMessage); //sfs.AddEventListener(SFSEvent.ROOM_JOIN, OnRoomJoin); sfs.AddEventListener(SFSEvent.ROOM_JOIN_ERROR, OnRoomJoinError); sfs.AddEventListener(SFSEvent.PUBLIC_MESSAGE, OnPublicMessage); //sfs.AddEventListener(SFSEvent.USER_ENTER_ROOM, OnUserEnterRoom); sfs.AddEventListener(SFSEvent.USER_EXIT_ROOM, OnUserExitRoom); //sfs.AddEventListener(SFSEvent.ROOM_ADD, OnRoomAdd); // Set connection parameters ConfigData cfg = new ConfigData(); cfg.Host = defaultHost; cfg.Port = Convert.ToInt32(defaultTcpPort.ToString()); cfg.Zone = zone; //cfg.Debug = true; // Connect to SFS2X sfs.Connect(cfg); } else { // Disconnect from SFS2X sfs.Disconnect(); trace("Disconnected"); } }
void OnLoginError(BaseEvent evt) { _smartFoxServer.Disconnect(); ResetLogin(); string errorMessage = "Login failed: " + (string)evt.Params["errorMessage"]; DebugConsole.Log(errorMessage, "error"); }
internal void Disconnect() { lock (smartFoxLock) { if (smartFox != null) { smartFox.Disconnect(); } } }
private void OnLoginError(BaseEvent evt) { Debug.Log("On Login error"); sfs.Disconnect(); reset(); Debug.Log("Login failed: " + (string)evt.Params["errorMessage"]); }
private void ShutdownServer() { if (smartFox != null) { smartFox.RemoveAllEventListeners(); if (smartFox.IsConnected) { smartFox.Disconnect(); } } }
public static void Disconnect() { if (sfs != null) { sfs.RemoveAllEventListeners(); if (sfs.IsConnected) { sfs.Disconnect(); } } }
private void OnLoginError(BaseEvent evt) { _sfs.Disconnect(); var user = (string)evt.Params["user"]; var message = (string)evt.Params["errorMessage"]; var code = (string)evt.Params["errorCode"]; GD.Print($"Unable to login to {_config.Host} as {user}"); GD.Print($"code={code}, message={message}"); }
public void Disconnect() { IsConnected = false; isConnecting = false; if (sfs == null) { return; } sfs.Disconnect(); sfs = null; }
public void Button_Clicked(string buttonName) { if (buttonName == "LoginButton") { string EncryptedPW = PasswordUtil.MD5Password(PasswordTB.text); SFServer.Send(new LoginRequest(UsernameTB.text, EncryptedPW, GAME_ZONE)); } if (buttonName == "RegisterButton") { SFServer.Send(new LoginRequest("", "", GAME_ZONE)); this.RegisterPanel.SetActive(true); this.LoginPanel.SetActive(false); } if (buttonName == "ExitButton") { SFServer.Disconnect(); SFServer.RemoveAllEventListeners(); Application.Quit(); } if (buttonName == "CreateButton") { InputField UsernameTB = GameObject.Find("UsernameTB").GetComponent <InputField>(); InputField PasswordTB = GameObject.Find("PasswordTB").GetComponent <InputField>(); InputField ConfirmPasswordTB = GameObject.Find("ConfirmPasswordTB").GetComponent <InputField>(); InputField EmailTB = GameObject.Find("EmailTB").GetComponent <InputField>(); InputField RegistrationKeyTB = GameObject.Find("RegistrationKeyTB").GetComponent <InputField>(); if (PasswordTB.text == ConfirmPasswordTB.text) { SFSObject NewAccountObject = new SFSObject(); NewAccountObject.PutUtfString("Username", UsernameTB.text); NewAccountObject.PutUtfString("PasswordHash", PasswordTB.text); NewAccountObject.PutUtfString("Email", EmailTB.text); NewAccountObject.PutUtfString("RegistrationKey", RegistrationKeyTB.text); this.SFServer.Send(new ExtensionRequest("$SignUp.Submit", NewAccountObject)); } else { if (!MessageText.activeInHierarchy) { MessageText.SetActive(true); } MessageText.GetComponent <Text>().text = "Passwords do not match! Please check and try again."; } } if (buttonName == "BackButton") { this.LoginPanel.SetActive(true); this.RegisterPanel.SetActive(false); } }
// ------------------------------------------------------------------------ // Die Applikation kontrolliert beenden public void ApplicationQuit() { if (sfs != null && sfs.IsConnected) { Debug.Log("[" + this.name + "] [" + this.GetType().Name + "] Connection wird beendet"); sfs.Disconnect(); } else { if (sfs != null && !sfs.IsConnected) { Debug.Log("[" + this.name + "] [" + this.GetType().Name + "] Connection ist bereits beendet"); } } }
public void OnDisconnectClick() { if (sfs.LastJoinedRoom != null) { sfs.Send(new Sfs2X.Requests.LeaveRoomRequest(sfs.LastJoinedRoom)); } else { Debug.LogError("No room was found to leave"); } if (sfs.IsConnected) { sfs.Disconnect(); } }