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

        // Remove SFS2X listeners
        sfs.RemoveAllEventListeners();

        SceneManager.LoadScene("Menu");
    }
예제 #2
0
 private void ShutdownServer()
 {
     if (smartFox != null)
     {
         smartFox.RemoveAllEventListeners();
         if (smartFox.IsConnected)
         {
             smartFox.Disconnect();
         }
     }
 }
예제 #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);
        }
    }
예제 #4
0
파일: MemLog.cs 프로젝트: wedAteeq/gcity
    //-----------------------------------------------------------------------Reset

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

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

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

        // load into game
        SceneManager.LoadScene("main");
    }
예제 #7
0
    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);
    }
예제 #8
0
 void OnApplicationQuit()
 {
     if (_smartFox.IsConnected)
     {
         Debug.Log("Quit...");
         _smartFox.RemoveAllEventListeners();
         _smartFox.Disconnect();
     }
 }
예제 #9
0
    void ResetLogin()
    {
        if (_smartFoxServer != null)
        {
            _smartFoxServer.RemoveAllEventListeners();
        }

        _connectButton.interactable = true;
    }
예제 #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();
    }
예제 #11
0
파일: Login.cs 프로젝트: vesche/snippets
    void OnRoomJoin(BaseEvent e)
    {
        // Debug.Log("joined room test");

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

        // load into game
        SceneManager.LoadScene("game");
    }
예제 #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);
     }
 }
예제 #13
0
 public static void Disconnect()
 {
     if (sfs != null)
     {
         sfs.RemoveAllEventListeners();
         if (sfs.IsConnected)
         {
             sfs.Disconnect();
         }
     }
 }
예제 #14
0
    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();
    }
예제 #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);
 }
예제 #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;
    }
예제 #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    = "";
    }
예제 #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);
    }
예제 #19
0
 private void lostConnectionHandler(BaseEvent evt)
 {
     gm.trace("Lost Connection");
     sfs.RemoveAllEventListeners();
     SceneManager.LoadScene("Connection");
 }
예제 #20
0
 public void RemoveListener()
 {
     sfs.RemoveAllEventListeners();
 }
예제 #21
0
 private void OnConnectionLost(BaseEvent e)
 {
     // Reset all internal states so we kick back to login screen
     smartfox.RemoveAllEventListeners();
     Application.LoadLevel(0);
 }
예제 #22
0
 private void reset()
 {
     sfs.RemoveAllEventListeners();
 }
예제 #23
0
 private void OnConnectionLost(BaseEvent e)
 {
     sfs.RemoveAllEventListeners();
     sfs.Disconnect(); // might not need this?
     SceneManager.LoadScene("main");
 }
예제 #24
0
 public void OnConnectionLost(BaseEvent evt)
 {
     Debug.LogWarning("OnConnectionLost");
     sfs.RemoveAllEventListeners();
     SceneManager.LoadScene("Connection");
 }
예제 #25
0
 private void OnConnectionLost(BaseEvent e)
 {
     Log.text = "connection lost";
     sfs.RemoveAllEventListeners();
 }
예제 #26
0
 private void UnsubscribeDelegates()
 {
     smartFox.RemoveAllEventListeners();
 }
예제 #27
0
 public void reset()
 {
     //sfs.Disconnect();
     sfs.RemoveAllEventListeners();
 }
예제 #28
0
 public void OnConnectionLost(BaseEvent evt)
 {
     // Reset all internal states so we kick back to login screen
     sfs.RemoveAllEventListeners();
     SceneManager.LoadScene("Connection");
 }
예제 #29
0
    /* ====================================================
     * 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();
    }
예제 #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();
 }