예제 #1
0
        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();
        }
예제 #3
0
 void OnApplicationQuit()
 {
     if (SfsReady)
     {
         sfs.Disconnect();
         print("Disconnected");
     }
 }
예제 #4
0
 void OnApplicationQuit()
 {
     // Always disconnect before quitting
     if (sfs != null && sfs.IsConnected)
     {
         sfs.Disconnect();
     }
 }
예제 #5
0
    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"]);
    }
예제 #6
0
파일: MemLog.cs 프로젝트: wedAteeq/gcity
    }    //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
    }
예제 #7
0
    }    //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);
    }
예제 #8
0
 // Handle disconnection automagically
 // ** Important for Windows users - can cause crashes otherwise
 void OnApplicationQuit()
 {
     if (smartFox != null && smartFox.IsConnected)
     {
         smartFox.Disconnect();
     }
 }
예제 #9
0
    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();
        }
    }
예제 #10
0
 private void OnApplicationQuit()
 {
     if (smartFox.IsConnected)
     {
         smartFox.Disconnect();
     }
 }
예제 #11
0
    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();
    }
예제 #12
0
 /**
  * Disconnect from the socket when shutting down the game
  */
 public void OnApplicationQuit()
 {
     if (sfs != null)
     {
         sfs.Disconnect();
     }
 }
예제 #13
0
 // Handle disconnection automagically
 // ** Important for Windows users - can cause crashes otherwise
 void OnApplicationQuit()
 {
     if (sfs.IsConnected)
     {
         sfs.Disconnect();
     }
 }
예제 #14
0
 // Handle disconnection
 // ** Important for Windows users - can cause crashes otherwise
 void OnApplicationQuit()
 {
     if (SFServer.IsConnected)
     {
         SFServer.Disconnect();
     }
 }
예제 #15
0
 protected void OnApplicationQuit()
 {
     if (smartFox.IsConnected)
     {
         UnregisterSFSSceneCallbacks();
         smartFox.Disconnect();
     }
 }
예제 #16
0
 void OnApplicationQuit()
 {
     RemoveLocalPlayer();
     if (sfs.IsConnected)
     {
         sfs.Disconnect();
     }
 }
예제 #17
0
 void OnDestroy()
 {
     //关闭时,断开与服务器连接
     if (sfs != null && sfs.IsConnected)
     {
         sfs.Disconnect();
     }
 }
예제 #18
0
 IEnumerator coroutineDisconect()
 {
     sfs.Disconnect();
     while (sfs.IsConnected)
     {
         yield return(new WaitForEndOfFrame());
     }
     Application.Quit();
 }
예제 #19
0
 void OnApplicationQuit()
 {
     if (_smartFox.IsConnected)
     {
         Debug.Log("Quit...");
         _smartFox.RemoveAllEventListeners();
         _smartFox.Disconnect();
     }
 }
예제 #20
0
    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");
        }
    }
예제 #21
0
    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"]);
    }
예제 #24
0
 private void ShutdownServer()
 {
     if (smartFox != null)
     {
         smartFox.RemoveAllEventListeners();
         if (smartFox.IsConnected)
         {
             smartFox.Disconnect();
         }
     }
 }
예제 #25
0
 public static void Disconnect()
 {
     if (sfs != null)
     {
         sfs.RemoveAllEventListeners();
         if (sfs.IsConnected)
         {
             sfs.Disconnect();
         }
     }
 }
예제 #26
0
        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}");
        }
예제 #27
0
        public void Disconnect()
        {
            IsConnected  = false;
            isConnecting = false;
            if (sfs == null)
            {
                return;
            }

            sfs.Disconnect();
            sfs = null;
        }
예제 #28
0
    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);
        }
    }
예제 #29
0
 // ------------------------------------------------------------------------
 // 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");
         }
     }
 }
예제 #30
0
    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();
        }
    }