コード例 #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();
            }
        }
コード例 #2
0
        private void OnLoginError(BaseEvent evt)
        {
            var message = (string)evt.Params["errorMessage"];

            GD.Print($"Login error; message={message}");
            _sfs.Disconnect();
        }
コード例 #3
0
ファイル: Connection.cs プロジェクト: akc8012/DiceGame
 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
ファイル: QuickPlayButton.cs プロジェクト: lukebitts/Tag
    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
ファイル: DeletionCrashFixer.cs プロジェクト: lukebitts/Tag
 IEnumerator coroutineDisconect()
 {
     sfs.Disconnect();
     while (sfs.IsConnected)
     {
         yield return(new WaitForEndOfFrame());
     }
     Application.Quit();
 }
コード例 #19
0
ファイル: SmartFoxConnector.cs プロジェクト: phamdat/dixit
 void OnApplicationQuit()
 {
     if (_smartFox.IsConnected)
     {
         Debug.Log("Quit...");
         _smartFox.RemoveAllEventListeners();
         _smartFox.Disconnect();
     }
 }
コード例 #20
0
ファイル: SFS.cs プロジェクト: a-a-lohn/colt-express
    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");
    }
コード例 #22
0
 internal void Disconnect()
 {
     lock (smartFoxLock)
     {
         if (smartFox != null)
         {
             smartFox.Disconnect();
         }
     }
 }
コード例 #23
0
    private void OnLoginError(BaseEvent evt)
    {
        Debug.Log("On Login error");

        sfs.Disconnect();

        reset();

        Debug.Log("Login failed: " + (string)evt.Params["errorMessage"]);
    }
コード例 #24
0
ファイル: CommunicationManager.cs プロジェクト: shldn/mdons
 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
ファイル: MultiplayerManager.cs プロジェクト: lukebitts/Tag
    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();
        }
    }