コード例 #1
0
ファイル: Form1.cs プロジェクト: oritabibi/ProjectGame
        private void NextScreen(int num_players, Boolean gamechoise)
        {
            GameBox.Program.GameChoice  = gamechoise;
            GameBox.Program.cnt_players = num_players;
            login_form login = new login_form(Wmp);

            Wmp.controls.pause();
            Form1 temp = new Form1();

            this.Hide();
            temp.Close();
            login.Show();
        }
コード例 #2
0
 private void Bt_User_login_Click(object sender, EventArgs e) /* Player login */
 {
     if (Program.Test_Insert_Text(Tb_user_name.Text) == false)
     {
         MessageBox.Show("Only english characters and numbers allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (Program.Test_Insert_Text(Tb_user_password.Text) == false)
     {
         MessageBox.Show("Only english characters and numbers allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (GameBox.Program.User_Check(Tb_user_name.Text) == false)/* check if name and password a valid */
     {
         MessageBox.Show("Invalid User Name - Wrong Input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (GameBox.Program.Password_Check(Tb_user_password.Text) == false)
     {
         MessageBox.Show("Invalid Password - Wrong Input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (comboBox1.Text == "Sign in")                                              /* if combo box is on login */
     {
         if (GameBox.Program.Check_NAME_exsist(Tb_user_name.Text, "Players") == 0) /* check if name exisist in database */
         {
             MessageBox.Show("User Name Does not Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (GameBox.Program.Check_Password_Is_correct(Tb_user_name.Text, Tb_user_password.Text, "Players") == false) /* check if password is correct */
         {
             MessageBox.Show("Invalid Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     else if (comboBox1.Text == "Sign up")                                                           /* if combo box is on sign up */
     {
         if (GameBox.Program.Insert_User_PLayers(Tb_user_name.Text, Tb_user_password.Text) == false) /* insurt user to players database */
         {
             MessageBox.Show("User Name alreay exsist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         GameBox.Program.Insert_User__Scores(Tb_user_name.Text); /*insurt user to score database */
         MessageBox.Show("User Created!", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     GameBox.Program.user1    = Tb_user_name.Text;             /* save users name */
     GameBox.Program.TypeUser = true;
     GameBox.Program.InsertLogin(Tb_user_name.Text, "Player"); /* insert login time to login database*/
     Tb_user_name.Text     = "";
     Tb_user_password.Text = "";
     if (cob_players.SelectedIndex == 0)
     {
         Program.cnt_players = 1; /* count players update */
         Users_options us = new Users_options(this);
         us.Show();               /* open nex screen */
         this.Hide();             /* hide this screen */
     }
     else
     {
         Program.cnt_players = 2;
         login_form log = new login_form(this);
         log.Show();
         this.Hide();
     }
 }