Esempio n. 1
0
        private void Moving(Point point)
        {
            PictureBox a = FirstSelect.Pop();

            a.Location = point;
            SecondSelect.Push(a);
            move++;
            label5.Text       = string.Format("Số bước đi : {0}", move);
            FirstSelect       = SecondSelect = null;
            ABoxPic.BackColor = BBoxPic.BackColor = CBoxPic.BackColor = System.Drawing.Color.Gray;

            if (RodC.Count == Level.Value && Level.Value != 9)
            {
                GiveUpButton.PerformClick();
                MessageBox.Show("Bạn đã qua màn này. Mời bạn chơi level tiếp theo  ", "CHÚC MỪNG!!!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Level.Value = Level.Value + 1;
                PlayButton.PerformClick();
            }
            else if (RodC.Count == Level.Value && Level.Value == 9)
            {
                GiveUpButton.PerformClick();
                MessageBox.Show("Bạn đã vượt qua 9 màn, trò chơi kết thúc  ", "CHÚC MỪNG!!!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }            //if(Level.Value<8,)
                         //throw new NotImplementedException();
        }
Esempio n. 2
0
 /// <summary>
 /// Event handler for when keydown is pressed with focus on the game form. Relevant for enter key.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GameForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         PlayButton.PerformClick();
     }
 }
 private void PlayerName_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar.ToString() == "\r")
     {
         if (string.IsNullOrEmpty(Player1Name.Text) || string.IsNullOrEmpty(Player2Name.Text) && !checkedForBothPlayers)
         {
             performThisIfPlayerDetailsNotEnteredProperly();
             checkedForBothPlayers = true;
         }
         PlayButton.PerformClick();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// This method handles the key bind presses
 /// NOTE: This might trigger anti-virus software
 /// as this is a popular method used in keyloggers
 /// </summary>
 private void GKS_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == startKey)
     {
         PlayButton.PerformClick();
     }
     else if (e.KeyCode == stopKey)
     {
         StopButton.PerformClick();
     }
     e.Handled = true;
 }
Esempio n. 5
0
        /// <summary>
        /// для шорткатов на форме игры
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormGame_KeyDown(object sender, KeyEventArgs e)
        {
            Shortcuts(Keys.D1, 0, 0, tablePanel_Choices, e, sender);
            Shortcuts(Keys.D2, 1, 0, tablePanel_Choices, e, sender);
            Shortcuts(Keys.Q, 0, 1, tablePanel_Choices, e, sender);
            Shortcuts(Keys.W, 1, 1, tablePanel_Choices, e, sender);
            Shortcuts(Keys.Space, 2, 0, tablePanel_Choices, e, sender);

            if (e.KeyCode == Keys.Enter)
            {
                PlayButton.PerformClick();
            }
        }
Esempio n. 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     PlayButton.PerformClick();
     ThapHaNoi(Level.Value, ABoxPic, BBoxPic, CBoxPic);
     timer2.Start();
 }
Esempio n. 7
0
 //Caputure KeyStrokes
 private void MainForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (MainScore != null)
     {
         //Escape
         if (!e.Control && e.KeyCode == Keys.Escape)
         {
             MainScore.ClearSelectedNoteArrays();
         }
         //Copy
         if (e.Control && e.KeyCode == Keys.C)
         {
             Copy();
         }
         //Cut
         if (e.Control && e.KeyCode == Keys.X)
         {
             Cut();
         }
         //Paste
         if (e.Control && e.KeyCode == Keys.V)
         {
             Paste();
         }
         //Delete
         if (!e.Control && e.KeyCode == Keys.Delete)
         {
             Delete();
         }
         if (e.Control && e.KeyCode == Keys.A)
         {
             SelectAll();
         }
         //Delete Tool Shortcut
         if (!e.Control && e.KeyCode == Keys.D)
         {
             DeleteButton.PerformClick();
         }
         //Select Tool Shortcut
         if (!e.Control && e.KeyCode == Keys.S)
         {
             SelectButton.PerformClick();
         }
         //Note Tool Shortcut
         if (!e.Control && e.KeyCode == Keys.N)
         {
             NoteLengthComboBox.Focus();
         }
         //Tempo Tool Shortcut
         if (!e.Control && e.KeyCode == Keys.T)
         {
             TempoButton.PerformClick();
         }
         //Instrument Tool Shortcut
         if (!e.Control && e.KeyCode == Keys.I)
         {
             InstrumentButton.PerformClick();
         }
         //Snapper Tool Shortcut
         if (e.Control && e.KeyCode == Keys.S)
         {
             SnapButton.PerformClick();
         }
         //Zoom Tool Shortcut : Out
         if (e.Control && e.KeyCode == Keys.OemMinus)
         {//http://stackoverflow.com/questions/3968423/what-is-the-enum-for-minus-underscore-and-equal-plus-key-in-keys-enumera
             ZoomMinusButton.PerformClick();
         }
         //Zoom Tool Shortcut : In
         if (e.Control && e.KeyCode == Keys.Oemplus)
         {
             ZoomPlusButton.PerformClick();
         }
         //Play Shortcut
         if (!e.Control && e.KeyCode == Keys.Space)
         {
             PlayButton.PerformClick();
         }
         MainScore.ScorePictureBox.Refresh();
     }
 }