Exemple #1
0
        private void btn_Options_Click(object sender, EventArgs e)
        {
            if (this._computerMoving == true)
            {
                return;
            }

            Form_Options form_temp = new Form_Options(this._language);

            if (form_temp.ShowDialog() == DialogResult.OK && board != null)
            {
                //Save this game

                ChessState[,] SaveThisState = new ChessState[10, 10];

                int i, j;
                for (i = 0; i < 10; i++)
                {
                    for (j = 0; j < 10; j++)
                    {
                        SaveThisState[i, j] = new ChessState(board.arrState[i, j].Type, board.arrState[i, j].Side, board.arrState[i, j].Moves);
                    }
                }

                eGameStatus       gameStatus         = board.GameStatus;
                eGameEndReason    gameStatusReason   = board.GameStatusReason;
                eChessSide        whoTurn            = board.WhoTurn;
                ArrayList         arrWhoCheck        = board.arrWhoCheck;
                Stack <ChessMove> stkUndo            = board.stkUndo;
                Stack <ChessMove> stkRedo            = board.stkRedo;
                Stack <String>    stkChessMoveString = board.stkChessMoveString;
                Stack <Bitmap_Side_ChessPieceEated> stkChessPieceEated = board.stkChessPieceEated;
                bool  clearStackRedo   = board.clear_Stack_Redo;
                Point positionLastMove = new Point(Uc_ChessBoard.PositionLastMove.X, Uc_ChessBoard.PositionLastMove.Y);
                Point positionChoosen  = new Point(board.PositionChoosen.X, board.PositionChoosen.Y);
                Dictionary <string, int> arrPosition = board.arrPosition;

                if (this._gameMode == eGameMode.VsComputer)
                {
                    CreateChessBoard(this._ownSide, this._gameMode, this._gameDifficulty, SaveThisState);
                }
                else
                {
                    CreateChessBoard(this._ownSide, this._gameMode, SaveThisState);
                }

                //Unload this game
                board.GameStatus               = gameStatus;
                board.GameStatusReason         = gameStatusReason;
                board.WhoTurn                  = whoTurn;
                board.arrWhoCheck              = arrWhoCheck;
                board.stkUndo                  = stkUndo;
                board.stkRedo                  = stkRedo;
                board.stkChessMoveString       = stkChessMoveString;
                board.clear_Stack_Redo         = clearStackRedo;
                Uc_ChessBoard.PositionLastMove = new Point(positionLastMove.X, positionLastMove.Y);
                board.PositionChoosen          = new Point(positionChoosen.X, positionChoosen.Y);
                board.arrPosition              = arrPosition;
                board.stkChessPieceEated       = stkChessPieceEated;
                ucChessPieceEated1.LoadChessPieces(board.stkChessPieceEated);
                ucChessPieceEated2.LoadChessPieces(board.stkChessPieceEated);
            }
        }
Exemple #2
0
 public GameStatus(eGameStatus status, eGameEndReason reason)
 {
     this.Status = status;
     this.Reason = reason;
 }