コード例 #1
0
    void onRegisterClick()
    {
        if (registrationView.data.password != registrationView.data.passwordConfirm)
        {
            registrationView.error        = true;
            registrationView.errorMessage = "Password and Confirm password don't match!";
            return;
        }

        LoginRequest lr = new LoginRequest();

        if (!lr.doLoginAsGuest())
        {
            registrationView.error        = true;
            registrationView.errorMessage = lr.getErrorMessage();
            return;
        }

        Debug.Log("Guest session key: lr.getKey()");
        RegisterRequest ur = new RegisterRequest(lr.getKey(),
                                                 registrationView.data.login,
                                                 registrationView.data.password,
                                                 registrationView.data.email,
                                                 registrationView.data.login);

        if (!ur.doRegister())
        {
            registrationView.error        = true;
            registrationView.errorMessage = ur.getErrorMessage();
            return;
        }

        m_Key = lr.getKey();
        UserSessionUtils.setUserSession(0, registrationView.data.login, lr.getKey());
        Application.LoadLevel(1);
    }