コード例 #1
0
        //一切转向为顺时针方向转
        private void GameChange(Tetromino Tetromino)
        {
            if (Tetromino.Equals(Tetromino.O))
            {
                return;
            }
            //清除当前状态
            foreach (int item in CurrentArry)
            {
                GameArry[item / 10, item % 10] = 0;
            }
            for (int i = 0; i < CurrentArry.Length; i++)
            {
                PicBox[CurrentArry[i]].BackColor   = Color.Black;
                PicBox[CurrentArry[i]].BorderStyle = BorderStyle.None;
            }

            //进行变换
            switch (Tetromino)
            {
            case Tetromino.S: ChangeS();
                break;

            case Tetromino.Z: ChangeZ();
                break;

            case Tetromino.L: ChangeL();
                break;

            case Tetromino.J: ChangeJ();
                break;

            case Tetromino.I: ChangeI();
                break;

            case Tetromino.O:
                break;

            case Tetromino.T: ChangeT();
                break;

            default: break;
            }

            //进行下一状态
            foreach (int item in CurrentArry)
            {
                GameArry[item / 10, item % 10] = 1;
            }
            for (int i = 0; i < CurrentArry.Length; i++)
            {
                PicBox[CurrentArry[i]].BackColor   = Color.Red;
                PicBox[CurrentArry[i]].BorderStyle = BorderStyle.FixedSingle;
            }
        }