示例#1
0
    public void ConfirmRegister_BTN_Click()
    {
        string feedback = UserUtilities.CreateremoteData(RegisterUsername_INPT.text, RegisterCard_INPT.text, RegisterPassword_INPT.text, RegisterVerifyPassword_INPT.text, RegisterEmail_INPT.text);

        switch (feedback)
        {
        case "BadConnection":
            DisplayNotification(true, "Cannot connect. Please ensure wifi or mobile data connection.");
            break;

        case "EmptyField":
            DisplayNotification(true, "Please enter all fields");
            break;

        case "InvalidCard":
            DisplayNotification(true, "Invalid Library Card");
            break;

        case "UsernameTooShort":
            DisplayNotification(true, "Username should be 3 or more characters long");
            break;

        case "UsernameIllegal":
            DisplayNotification(true, "Username inappropriate");
            break;

        case "InvalidEmail":
            DisplayNotification(true, "Not a valid Email format");
            break;

        case "UserExists":
            DisplayNotification(true, "Library card is already registered");
            break;

        case "MismatchedPass":
            DisplayNotification(true, "Passwords do not match");
            break;

        case "WeakPass":
            DisplayNotification(true, "Password needs to be " + UserUtilities.minPassLength + " - " + UserUtilities.MaxInputLength + " characters long and contain 1 uppercase, 1 symbol, & 1 number");
            break;

        case "Created":
            LoginCard_INPT.text     = RegisterCard_INPT.text;
            LoginPassword_INPT.text = RegisterPassword_INPT.text;
            ClearRegisterInput();
            GameManager.Instance.SetState(GameManager.GameState.Login);
            break;

        case "Error":
            DisplayNotification(true, "Unexpected error. Please try again.");
            break;
        }
    }