예제 #1
0
    private void CreateAccount()
    {
        if (passwordLabel.text != confPasswordLabel.text)
        {
            errorLabel.color       = Color.red;
            errorLabel.text        = "Passwords do not match.";
            passwordLabel.text     = "";
            confPasswordLabel.text = "";
        }
        else
        {
            IWebApiResponse response = webApi.CreateUser(usernameLabel.text, passwordLabel.text, nameLabel.text);

            if (response is ErrorResponse)
            {
                errorLabel.color = Color.red;
                errorLabel.text  = (response as ErrorResponse).displayError;
            }
            else
            {
                PlayerPrefs.SetString("email", usernameLabel.text);
                PlayerPrefs.SetString("password", passwordLabel.text);
                ShowMainMenu();
            }
        }
    }