示例#1
0
		private void Blk_squareStopped() {
			if(this.blk.Top <= 30){
				timer.Stop();
                timer1.Stop();
                //MessageBox.Show("Игра окончена.");
                Form2 form2 = new Form2();
                form2.Show();
                form2.Controls[2].Text = textScore.Text;
			    form2.Controls[0].Text = label5.Text;
                this.Text = Application.ProductName + "  Нажмите Ентер для старта";
				GameField.Reset();
				field.CreateGraphics().Clear(Color.White);
				nextBlock.CreateGraphics().Clear(Color.White);
			}else{
			    score += GameField.CheckLines()* (100 - (timer.Interval/10));
                this.textScore.Text = score.ToString() + " oчков";

              

				blk = new Block(new Point(90,GameField.FieldTopBound + (GameField.SquareSize * 5)),next.BlkType);
				blk.squareStopped +=new SquareStoppedEventHandler(Blk_squareStopped);
			    blk.Show(field.Handle);

				nextBlock.CreateGraphics().Clear(Color.White);
				this.next = new Block(new Point(35,35));			
				next.Show(nextBlock.Handle);
			}
			
		}
示例#2
0
        private void Start()
        {
            if (timer.Enabled == false)
            {
                this.Text = Application.ProductName;
                this.textScore.Text = " 0 oчков";
                this.lblGameSpeed.Text = "";
                this.score = 0;

                GameField.Field = field.Handle;

                blk = new Block(new Point(90, GameField.FieldTopBound + (GameField.SquareSize * 5)));
                blk.squareStopped += new SquareStoppedEventHandler(Blk_squareStopped);
                blk.Show(field.Handle);

                this.next = new Block(new Point(45, 35));
                next.Show(nextBlock.Handle);

                this.lblGameSpeed.Text = ((GameSpeed)timer.Interval).ToString();
                timer.Enabled = true;
                timer1.Enabled = true;
            }
            else
            {
                timer.Enabled = true;
                timer1.Enabled = true;
            }
        }