Beispiel #1
0
 //
 //
 //
 private void StopGoToggle()
 {
     if (this.TetrixState == TetrixStateEnum.StartedState)
     {
         TetrixState          = TetrixStateEnum.PausedState;
         timer1.Enabled       = false;
         btnStopGo.Visible    = true;
         btnQuit.Visible      = true;
         radioButton1.Visible = true;
         radioButton2.Visible = true;
         radioButton3.Visible = true;
         btnStopGo.Focus();
     }
     else if ((this.TetrixState == TetrixStateEnum.StoppedState))
     {
         NewGame();
         TetrixState          = TetrixStateEnum.StartedState;
         timer1.Enabled       = true;
         btnStopGo.Visible    = false;
         btnQuit.Visible      = false;
         radioButton1.Visible = false;
         radioButton2.Visible = false;
         radioButton3.Visible = false;
         Focus();
     }
     else if ((this.TetrixState == TetrixStateEnum.PausedState))
     {
         TetrixState          = TetrixStateEnum.StartedState;
         timer1.Enabled       = true;
         btnStopGo.Visible    = false;
         btnQuit.Visible      = false;
         radioButton1.Visible = false;
         radioButton2.Visible = false;
         radioButton3.Visible = false;
         Focus();
     }
     else if ((this.TetrixState == TetrixStateEnum.GameOverState))
     {
         TetrixState          = TetrixStateEnum.StoppedState;
         timer1.Enabled       = false;
         btnStopGo.Visible    = true;
         btnStopGo.Text       = "New Game";
         btnQuit.Visible      = true;
         radioButton1.Visible = true;
         radioButton2.Visible = true;
         radioButton3.Visible = true;
         this.Focus();
     }
     else
     {
         throw new Exception("Tetrix in unknown State (1)");
     }
 }
Beispiel #2
0
 //
 // Method: NewGame();
 //
 private void NewGame()
 {
     TetrixState      = TetrixStateEnum.StoppedState;
     m_objEngine      = new Engine(ROWS, COLS);
     m_intShape       = m_objEngine.GetShape();
     m_intShapeHeight = m_objEngine.ShapeHeight;
     m_intShapeWidth  = m_objEngine.ShapeWidth;
     timer1.Interval  = TIMER_START;
     m_intScore       = 0;
     m_intLevel       = 1;
     m_intRowCount    = 0;
     m_intShapeCount  = 0;
     Refresh();
 }
Beispiel #3
0
 //
 //
 //
 private void StopGoToggle()
 {
     if (this.TetrixState == TetrixStateEnum.StartedState)
     {
         TetrixState = TetrixStateEnum.PausedState;
         timer1.Enabled = false;
         btnStopGo.Visible = true;
         btnQuit.Visible = true;
         radioButton1.Visible = true;
         radioButton2.Visible = true;
         radioButton3.Visible = true;
         btnStopGo.Focus();
     }
     else if ((this.TetrixState == TetrixStateEnum.StoppedState))
     {
         NewGame();
         TetrixState = TetrixStateEnum.StartedState;
         timer1.Enabled = true;
         btnStopGo.Visible = false;
         btnQuit.Visible = false;
         radioButton1.Visible = false;
         radioButton2.Visible = false;
         radioButton3.Visible = false;
         Focus();
     }
     else if ((this.TetrixState == TetrixStateEnum.PausedState))
     {
         TetrixState = TetrixStateEnum.StartedState;
         timer1.Enabled = true;
         btnStopGo.Visible = false;
         btnQuit.Visible = false;
         radioButton1.Visible = false;
         radioButton2.Visible = false;
         radioButton3.Visible = false;
         Focus();
     }
     else if ((this.TetrixState == TetrixStateEnum.GameOverState))
     {
         TetrixState = TetrixStateEnum.StoppedState;
         timer1.Enabled = false;
         btnStopGo.Visible = true;
         btnStopGo.Text = "New Game";
         btnQuit.Visible = true;
         radioButton1.Visible = true;
         radioButton2.Visible = true;
         radioButton3.Visible = true;
         this.Focus();
     }
     else
     {
         throw new Exception("Tetrix in unknown State (1)");
     }
 }
Beispiel #4
0
 //
 // Method: NewGame();
 //
 private void NewGame()
 {
     TetrixState = TetrixStateEnum.StoppedState;
     m_objEngine = new Engine(ROWS, COLS);
     m_intShape = m_objEngine.GetShape();
     m_intShapeHeight = m_objEngine.ShapeHeight;
     m_intShapeWidth = m_objEngine.ShapeWidth;
     timer1.Interval = TIMER_START;
     m_intScore = 0;
     m_intLevel = 1;
     m_intRowCount = 0;
     m_intShapeCount = 0;
     Refresh();
 }
Beispiel #5
0
 //
 //
 //
 private void GameOver()
 {
     this.TetrixState = TetrixStateEnum.GameOverState;
     StopGoToggle();
     MessageBox.Show("No more valid moves can be made!", "Game over!");
 }
Beispiel #6
0
 //
 //
 //
 private void GameOver()
 {
     this.TetrixState = TetrixStateEnum.GameOverState;
     StopGoToggle();
     MessageBox.Show("No more valid moves can be made!", "Game over!");
 }