Ejemplo n.º 1
0
        public 测试砖类型()
        {
            InitializeComponent();
            TemplateArry array = new TemplateArry();

            array.Add("0000001000011100000000000", Color.Blue);
            array.Add("0000000000111100000000000", Color.Green);
            array.Add("0000000110011000000000000", Color.Red);
            array.Add("0000000100011100000000000", Color.DarkCyan);
            array.Add("0000000100011000100000000", Color.OldLace);
            array.Add("0000000000011100100000000", Color.Orange);
            array.Add("0000000000011000110000000", Color.PeachPuff);
            //Point[] points = new Point[] { new Point(0, -1), new Point(1, -1), new Point(0, 0), new Point(0, 1) };
            m_Factory = new BrickFactory(array, Color.Black, 20);
            m_Brick   = m_Factory.CreatBrick();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 按键触发
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FormMain_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F2)
     {
         if (m_GamePalette != null)     //关闭当前游戏
         {
             m_GamePalette.Close();
             m_GamePalette = null;
         }
         TemplateArry array = new TemplateArry();
         array.Add("0000001000011100000000000", Color.FromArgb(-128));
         array.Add("0000000000111100000000000", Color.FromArgb(-65536));
         array.Add("0000000110011000000000000", Color.FromArgb(-16711936));
         array.Add("0000000100011100000000000", Color.FromArgb(-4144960));
         array.Add("0000000100011000100000000", Color.FromArgb(-16776961));
         array.Add("0000000000011100100000000", Color.FromArgb(-65281));
         array.Add("0000000000011000110000000", Color.FromArgb(-8323073));
         //开始新游戏
         m_GamePalette        = new GamePalette(13, 20, array, 20, Color.Black, pbMainPalette.CreateGraphics(), pbNextPalette.CreateGraphics(), 0, Color.Red, true);
         m_GamePalette.Height = pictureBox1.Height;
         m_GamePalette.Width  = pictureBox1.Width;
         m_GamePalette.Start();
     }
     else
     {
         if (m_GamePalette == null || m_GamePalette.IsGameOver)
         {
             return;
         }
         if (e.KeyCode == Keys.F3)
         {
             if (m_GamePalette.IsRunning)
             {
                 m_GamePalette.Pause();
             }
             else
             {
                 m_GamePalette.Resume();
             }
         }
         else if (e.KeyCode == Keys.Left)
         {
             m_GamePalette.MoveLeft();
         }
         else if (e.KeyCode == Keys.Right)
         {
             m_GamePalette.MoveRight();
         }
         else if (e.KeyCode == Keys.Down)
         {
             m_GamePalette.MoveDown();
         }
         else if (e.KeyCode == Keys.Up)
         {
             m_GamePalette.DeasilRotate();
         }
         else if (e.KeyCode == Keys.Space)
         {
             m_GamePalette.DropDown();
         }
     }
 }