Beispiel #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (game.MoveDownCheck(current, canvus))
     {
         current.MoveDown();
     }
     else
     {
         if (current.isBomb)
         {
             game.Bombard(current, canvus);
         }
         else
         {
             game.FixCube(current, canvus);
             game.ClearLine(canvus, ref score);
         }
         pictureBox1.Refresh();
         current = next;
         next    = game.RandomPattern2();
         End_Paint();
         Next_Paint();
         Score_Paint();
     }
     All_Paint(pe);
 }
Beispiel #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (lgame.MoveDownCheck(lcurrent, lcanvus))
     {
         lcurrent.MoveDown();
     }
     else
     {
         lgame.FixCube(lcurrent, lcanvus);
         lgame.ClearLine(lcanvus, ref lscore);
         pictureBox1.Refresh();
         lcurrent = lnext;
         lnext    = lgame.RandomPattern();
         if (timer1.Enabled == true)
         {
             End_Paint();
         }
         Next_paint(pictureBox3, lnext);
         Score_Paint("左", label1, lscore);
     }
     All_paint(lpe);
     if (rgame.MoveDownCheck(rcurrent, rcanvus))
     {
         rcurrent.MoveDown();
     }
     else
     {
         rgame.FixCube(rcurrent, rcanvus);
         rgame.ClearLine(rcanvus, ref rscore);
         pictureBox2.Refresh();
         rcurrent = rnext;
         rnext    = rgame.RandomPattern();
         if (timer1.Enabled == true)
         {
             End_Paint();
         }
         Next_paint(pictureBox4, rnext);
         Score_Paint("右", label2, rscore);
     }
     All_paint(rpe);
 }
Beispiel #3
0
 //计时器 每秒刷新一次界面
 private void timer_Tick(object sender, EventArgs e)
 {
     if (game.MoveDownCheck(current, canvus))
     {
         current.MoveDown();
     }
     else
     {
         game.FixCube(current, canvus);
         game.ClearLine(canvus, ref score);
         SendScore();
         pictureBox1.Refresh();
         current = next;
         next    = game.RandomPattern();
         Next_Paint();
         Score_Paint();
         End_Paint();
     }
     SendState();
     SendCurrent();
     All_Paint(pe);
     FriendAllPaint(pe);
 }
Beispiel #4
0
 private void GameTimer_Tick(object sender, EventArgs e)
 {
     this.lvl           = (this.totalCompletedRows / 10) + 1;
     this.level.Content = "" + lvl;
     if (this.lvl >= 10)
     {
         this.startColor.Color = Colors.Red;
     }
     else if (this.lvl >= 5)
     {
         this.startColor.Color = Colors.OrangeRed;
     }
     if (waitTime == 0)
     {
         this.myGameCanvas.Opacity = 1;
         this.gradient.Opacity     = .6;
         this.grid.Opacity         = .6;
         this.status.Content       = "";
         this.status.Opacity       = 0;
         this.wait.Content         = "";
         this.wait.Opacity         = 0;
         Boolean spawnAnother = true;
         fallingPattern.MoveDown();
         if (!fallingPattern.Stopped)
         {
             spawnAnother = false;
         }
         if (fallingPattern.IsTop())
         {
             lost = true;
         }
         if (lost)
         {
             if (Int32.Parse(bestScore.Content.ToString()) < this.curScore)
             {
                 this.bestScore.Content = "" + this.curScore;
             }
             this.gameTimer.IsEnabled  = false;
             this.myGameCanvas.Opacity = .6;
             this.gradient.Opacity     = .3;
             this.grid.Opacity         = .3;
             this.status.Content       = "Game Over! \nPress R to \nplay again.";
             this.status.Opacity       = 1;
         }
         if (spawnAnother && !lost)
         {
             UpdateGame();
             this.gameTimer.Interval = getTimeSpan();
             SpawnNext();
         }
     }
     else
     {
         this.myGameCanvas.Opacity = .6;
         this.gradient.Opacity     = .3;
         this.grid.Opacity         = .3;
         this.wait.Opacity         = 1;
         this.status.Opacity       = 0;
         this.wait.Content         = "" + this.waitTime;
         this.waitTime--;
     }
 }