Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public static void Update_music_bt() /* update Bt mussic on/off for all screens before opening */
 {
     foreach (Form f in Application.OpenForms)
     {
         if (f.GetType() == typeof(MainForm))
         {
             MainForm Newform = (GameBox.MainForm)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(GameChoice))
         {
             GameChoice Newform = (GameBox.GameChoice)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Guest_wait))
         {
             Guest_wait Newform = (GameBox.Guest_wait)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(login_form))
         {
             login_form Newform = (GameBox.login_form)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Managers_option))
         {
             Managers_option Newform = (GameBox.Managers_option)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Manager_Managment))
         {
             Manager_Managment Newform = (GameBox.Manager_Managment)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Reports))
         {
             Reports Newform = (GameBox.Reports)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(User_Managment))
         {
             User_Managment Newform = (GameBox.User_Managment)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Users_options))
         {
             Users_options Newform = (GameBox.Users_options)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Change_details))
         {
             Change_details Newform = (GameBox.Change_details)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Feedback_form))
         {
             Feedback_form Newform = (GameBox.Feedback_form)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Reversi))
         {
             Reversi Newform = (GameBox.Reversi)f;
             if (music_OnOff == false)
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Green_mute;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.CB_music.BackgroundImage       = Properties.Resources.Green_music;
                 Newform.CB_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
         else if (f.GetType() == typeof(Snake_and_ladders))
         {
             Snake_and_ladders Newform = (GameBox.Snake_and_ladders)f;
             if (music_OnOff == false)
             {
                 Newform.bt_music.BackgroundImage       = Properties.Resources.Mute_red;
                 Newform.bt_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
             else
             {
                 Newform.bt_music.BackgroundImage       = Properties.Resources.Music_red;
                 Newform.bt_music.BackgroundImageLayout = ImageLayout.Stretch;
             }
         }
     }
 }
Esempio n. 3
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();
     }
 }