Exemple #1
0
    // Room Handlers
    private void roomJoinHandler(BaseEvent e)
    {
        trace("Joined Room: " + e.Params["room"]);

        // Remove SFS2X listeners
        sfs.RemoveAllEventListeners();

        SceneManager.LoadScene("Menu");
    }
Exemple #2
0
 private void ShutdownServer()
 {
     if (smartFox != null)
     {
         smartFox.RemoveAllEventListeners();
         if (smartFox.IsConnected)
         {
             smartFox.Disconnect();
         }
     }
 }
Exemple #3
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);
        }
    }
Exemple #4
0
    //-----------------------------------------------------------------------Reset

    private void reset()
    {
        // Remove SFS2X listeners
        sfs.RemoveAllEventListeners();
        // Enable interface
        enableInterface(true);
    }
Exemple #5
0
    }//end extension

    private void reset()
    {
        // Remove SFS2X listeners
        sfs.RemoveAllEventListeners();

        sfs = null;
    }
Exemple #6
0
    void OnRoomJoin(BaseEvent e)
    {
        // remove sfs2x listeners and re-enable interface
        sfs.RemoveAllEventListeners();

        // load into game
        SceneManager.LoadScene("main");
    }
    private void reset()
    {
        // Remove SFS2X listeners
        // This should be called when switching scenes, so events from the server do not trigger code in this scene
        sfs.RemoveAllEventListeners();

        // Enable interface
        enableLoginUI(true);
    }
Exemple #8
0
 void OnApplicationQuit()
 {
     if (_smartFox.IsConnected)
     {
         Debug.Log("Quit...");
         _smartFox.RemoveAllEventListeners();
         _smartFox.Disconnect();
     }
 }
Exemple #9
0
    void ResetLogin()
    {
        if (_smartFoxServer != null)
        {
            _smartFoxServer.RemoveAllEventListeners();
        }

        _connectButton.interactable = true;
    }
Exemple #10
0
    private void reset()
    {
        List <Room> roomList = sfs.RoomManager.GetJoinedRooms();

        roomList.ForEach(room => {
            Debug.Log("sending leave room request " + room.Name);
            sfs.Send(new LeaveRoomRequest(room));
        });
        sfs.RemoveAllEventListeners();
    }
Exemple #11
0
    void OnRoomJoin(BaseEvent e)
    {
        // Debug.Log("joined room test");

        // remove sfs2x listeners and re-enable interface
        sfs.RemoveAllEventListeners();

        // load into game
        SceneManager.LoadScene("game");
    }
Exemple #12
0
 internal void RemoveListeners(SmartFox smartFox)
 {
     smartFox.RemoveAllEventListeners();
     if (smartFox.Debug)
     {
         smartFox.RemoveLogListener(LogLevel.DEBUG, onDebugMessage);
         smartFox.RemoveLogListener(LogLevel.INFO, onInfoMessage);
         smartFox.RemoveLogListener(LogLevel.WARN, onWarnMessage);
         smartFox.RemoveLogListener(LogLevel.ERROR, onErrorMessage);
     }
 }
Exemple #13
0
 public static void Disconnect()
 {
     if (sfs != null)
     {
         sfs.RemoveAllEventListeners();
         if (sfs.IsConnected)
         {
             sfs.Disconnect();
         }
     }
 }
    private void reset()
    {
        List <Room> roomList = sfs.RoomManager.GetJoinedRooms();

        roomList.ForEach(room => sfs.Send(new LeaveRoomRequest(room)));

        // Remove SFS2X listeners
        // This should be called when switching scenes,
        // so events from the server do not trigger code in this scene
        sfs.RemoveAllEventListeners();
    }
Exemple #15
0
 private void AddEventListeners()
 {
     if (smartFox == null)
     {
         Logger.traceError("[NetworkManager::AddEventListeners] - unable to add listeners -- smartFox is null ");
         return;
     }
     smartFox.RemoveAllEventListeners();
     smartFox.AddEventListener(SFSEvent.CONNECTION, OnConnection);
     smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
     smartFox.AddEventListener(SFSEvent.LOGIN, OnLogin);
     smartFox.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);
     smartFox.AddEventListener(SFSEvent.ROOM_JOIN, OnJoinRoom);
     smartFox.AddEventListener(SFSEvent.USER_ENTER_ROOM, OnUserEnterRoom);
     smartFox.AddEventListener(SFSEvent.USER_EXIT_ROOM, OnUserExitRoom);
     smartFox.AddEventListener(SFSEvent.LOGOUT, OnLogout);
     smartFox.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);
     smartFox.AddEventListener(SFSEvent.USER_VARIABLES_UPDATE, UpdateUserVariables);
     smartFox.AddEventListener(SFSEvent.ROOM_REMOVE, OnRoomDeleted);
     smartFox.AddEventListener(SFSEvent.ROOM_VARIABLES_UPDATE, OnUpdateRoomVariables);
 }
Exemple #16
0
    private void reset()
    {
        // Remove SFS2X listeners
        sfs.RemoveAllEventListeners();

        sfs.RemoveLogListener(LogLevel.DEBUG, OnDebugMessage);
        sfs.RemoveLogListener(LogLevel.INFO, OnInfoMessage);
        sfs.RemoveLogListener(LogLevel.WARN, OnWarnMessage);
        sfs.RemoveLogListener(LogLevel.ERROR, OnErrorMessage);

        sfs = null;
    }
Exemple #17
0
    }//end create account

    private void reset()
    {
        // Remove SFS2X listeners
        sfs.RemoveAllEventListeners();

        sfs = null;

        // Enable interface
        enableInterface(true);
        UserName.text    = "";
        Password.text    = "";
        ConPassword.text = "";
        Email.text       = "";
        FirstName.text   = "";
        LastName.text    = "";
    }
Exemple #18
0
    /// <summary>
    /// Método que recria a instância do SmartFox. É necessário ser chamado sempre que o cliente perde a conexão com o servidor. Em modo de
    /// debug essa instância também redireciona as mensagens do log para o console da Unity.
    /// </summary>
    /// <returns>A instância do SmartFox.</returns>
    public SmartFox Reset()
    {
        if (sfs != null)
        {
            sfs.RemoveAllEventListeners();
        }

#if DEBUG
        sfs = new SmartFox(true);
        sfs.Logger.LoggingLevel = LogLevel.INFO;

        sfs.AddLogListener(LogLevel.INFO, OnInfoMessage);
        sfs.AddLogListener(LogLevel.WARN, OnWarnMessage);
        sfs.AddLogListener(LogLevel.ERROR, OnErrorMessage);
#else
        sfs = new SmartFox(false);
#endif
        return(sfs);
    }
Exemple #19
0
 private void lostConnectionHandler(BaseEvent evt)
 {
     gm.trace("Lost Connection");
     sfs.RemoveAllEventListeners();
     SceneManager.LoadScene("Connection");
 }
 public void RemoveListener()
 {
     sfs.RemoveAllEventListeners();
 }
 private void OnConnectionLost(BaseEvent e)
 {
     // Reset all internal states so we kick back to login screen
     smartfox.RemoveAllEventListeners();
     Application.LoadLevel(0);
 }
Exemple #22
0
 private void reset()
 {
     sfs.RemoveAllEventListeners();
 }
Exemple #23
0
 private void OnConnectionLost(BaseEvent e)
 {
     sfs.RemoveAllEventListeners();
     sfs.Disconnect(); // might not need this?
     SceneManager.LoadScene("main");
 }
Exemple #24
0
 public void OnConnectionLost(BaseEvent evt)
 {
     Debug.LogWarning("OnConnectionLost");
     sfs.RemoveAllEventListeners();
     SceneManager.LoadScene("Connection");
 }
Exemple #25
0
 private void OnConnectionLost(BaseEvent e)
 {
     Log.text = "connection lost";
     sfs.RemoveAllEventListeners();
 }
Exemple #26
0
 private void UnsubscribeDelegates()
 {
     smartFox.RemoveAllEventListeners();
 }
Exemple #27
0
 public void reset()
 {
     //sfs.Disconnect();
     sfs.RemoveAllEventListeners();
 }
Exemple #28
0
 public void OnConnectionLost(BaseEvent evt)
 {
     // Reset all internal states so we kick back to login screen
     sfs.RemoveAllEventListeners();
     SceneManager.LoadScene("Connection");
 }
    /* ====================================================
     * Sonstige Hilfsmethoden
     *
     *
     *
     *
     * ====================================================
     */

    // ------------------------------------------------------------------------
    // Vor einem Scene-Wechsel alle Callbacks removen. Die neue Scene richtet ihre eigenen ein
    void UnregisterSFSSceneCallbacks()
    {
        Debug.Log("[" + this.name + "] [" + this.GetType().Name + "] Alle Callbacks der Scene " + Application.loadedLevelName + " werden zurueckgesetzt");
        sfs.RemoveAllEventListeners();
    }
Exemple #30
0
 protected void UnregisterSFSSceneCallbacks()
 {
     // This should be called when switching scenes, so callbacks from the backend do not trigger code in this scene
     smartFox.RemoveAllEventListeners();
     handlers.Clear();
 }