예제 #1
0
        private void Bt_Guest_login_Click(object sender, EventArgs e) /* guest login */
        {
            if (Program.Test_Insert_Text(Tb_guest_name.Text) == false)
            {
                MessageBox.Show("Only english characters and numbers allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (GameBox.Program.User_Check(Tb_guest_name.Text) == false)  /* check if name is valid */
            {
                MessageBox.Show("Invalid Guest Name - Wrong Input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            GameBox.Program.TypeUser = false;
            Program.cnt_players      = 1;
            GameBox.Program.guest    = Tb_guest_name.Text;            /* save guests name */
            GameBox.Program.InsertLogin(Tb_guest_name.Text, "Guest"); /* insert guest login in database*/
            Guest_wait g = new Guest_wait(this);

            Tb_guest_name.Text = "";
            Program.GameChoice = false;
            g.Show();    /* open nex screen */
            this.Hide(); /* hide this screen */
        }
예제 #2
0
파일: Program.cs 프로젝트: Yahavba/Game-Box
 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;
             }
         }
     }
 }