示例#1
0
        private void CPUMoveCompleted(Game.CellPos cellPos)
        {
            Button btn = GetButtonAtPosition(cellPos);

            if (btn != null)
            {
                btn.Text    = (Game.TTTGame.CPU_SYMBOL == Game.TTTGame.CellState.CROSS) ? "X" : "O";
                btn.Enabled = false;
                btn.Cursor  = Cursors.No;
            }
            if (gameObject.IsGameOver)
            {
                GameOver();
                return;
            }
            board.Enabled       = true;
            rbtnPlayer1.Checked = true;
        }
示例#2
0
 private Button GetButtonAtPosition(Game.CellPos pos)
 {
     if (pos == (Game.CellPos)btn00.Tag)
     {
         return(btn00);
     }
     if (pos == (Game.CellPos)btn01.Tag)
     {
         return(btn01);
     }
     if (pos == (Game.CellPos)btn02.Tag)
     {
         return(btn02);
     }
     if (pos == (Game.CellPos)btn10.Tag)
     {
         return(btn10);
     }
     if (pos == (Game.CellPos)btn11.Tag)
     {
         return(btn11);
     }
     if (pos == (Game.CellPos)btn12.Tag)
     {
         return(btn12);
     }
     if (pos == (Game.CellPos)btn20.Tag)
     {
         return(btn20);
     }
     if (pos == (Game.CellPos)btn21.Tag)
     {
         return(btn21);
     }
     if (pos == (Game.CellPos)btn22.Tag)
     {
         return(btn22);
     }
     return(null);
 }