Beispiel #1
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            int result = UserIO.checkSignUpDetails(txtName.Text, txtPassW.Text, txtPassWConfirm.Text);
            if (txtName.Text == "")
                lblEnterUsername.ForeColor = Color.Red;
            else
                lblEnterUsername.ForeColor = Color.Black;
            if (txtPassW.Text == "")
                lblEnterPassword.ForeColor = Color.Red;
            else
                lblEnterPassword.ForeColor = Color.Black;
            if (txtPassWConfirm.Text == "")
                lblConfirmPassword.ForeColor = Color.Red;
            else
                lblConfirmPassword.ForeColor = Color.Black;
            if (txtName.Text == "")
            {
                if (txtPassW.Text == "")
                {
                    lblDebug.Text = "Please enter account details";
                }
                else
                {
                    lblDebug.Text = "Please enter username";
                }
            }
            else
            {
                if (txtPassW.Text == "")
                {
                    lblDebug.Text = "Please enter password";
                }
            }
            switch (result)
            {
                case 1:
                    {
                        lblDebug.Text = "Username already exists.";
                        break;
                    }
                case 2:
                    {
                        lblDebug.Text = "Confirmation not the same";
                        lblConfirmPassword.ForeColor = Color.Red;
                        break;
                    }
                case 3:
                    {
                        lblDebug.Text = "Password must be at least 8 ch.";
                        break;
                    }
                case 0:
                    {
                        lblDebug.Text = "";
                        UserIO.addUser(txtName.Text, txtPassW.Text);
                        uploadUserList(fullPath);

                        MazeMap mazeMap = new MazeMap(UserIO.users[UserIO.currentPlayer].name, UserIO.users[UserIO.currentPlayer].score, UserIO.users[UserIO.currentPlayer].levelNr);
                        this.Hide();
                        mazeMap.ShowDialog();
                        this.Show();

                        break;
                    }
                default:
                    break;
            }
        }
Beispiel #2
0
 private void lblGuest_Click(object sender, EventArgs e)
 {
     MazeMap mazeMap = new MazeMap("Guest", 0, 1);
     this.Hide();
     mazeMap.ShowDialog();
     this.Show();
 }
Beispiel #3
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            int result = UserIO.checkSignInDetails(txtName.Text, txtPassW.Text);

            if (txtName.Text == "")
                lblEnterUsername.ForeColor = Color.Red;
            else
                lblEnterUsername.ForeColor = Color.Black;
            if (txtPassW.Text == "")
                lblEnterPassword.ForeColor = Color.Red;
            else
                lblEnterPassword.ForeColor = Color.Black;
            if (txtName.Text == "")
            {

                if (txtPassW.Text == "")
                {
                    lblDebug.Text = "Please enter account details";
                }
                else
                {
                    lblDebug.Text = "Please enter username";
                }
            }
            else
            {
                if (txtPassW.Text == "")
                {
                    lblDebug.Text = "Please enter password";
                }
            }
            switch (result)
            {
                case 1:
                    {
                        MazeMap mazeMap = new MazeMap(UserIO.users[UserIO.currentPlayer].name, UserIO.users[UserIO.currentPlayer].score, UserIO.users[UserIO.currentPlayer].levelNr);
                        this.Hide();
                        mazeMap.ShowDialog();
                        this.Show();
                        break;
                    }
                case 2:
                    {
                        lblEnterPassword.ForeColor = Color.Red;
                        lblDebug.Text = "Invalid password";
                        break;
                    }
                case 0:
                    {
                        lblEnterUsername.ForeColor = Color.Red;
                        lblDebug.Text = "Invalid username";
                        break;
                    }
                default:
                    break;
            }
        }