Exemplo n.º 1
0
 private void btn_Savegame_Click(object sender, EventArgs e)
 {
     if (board != null)
     {
         Save_Load_ChessBoard sBoard = new Save_Load_ChessBoard(this.board, this.ucCountDownTimer1, this.ucCountDownTimer2);
         sBoard.Save();
     }
 }
Exemplo n.º 2
0
        private void btn_Loadgame_Click(object sender, EventArgs e)
        {
            Save_Load_ChessBoard sBoard = new Save_Load_ChessBoard();
            Save_Load_ChessBoard saved  = sBoard.Load();

            if (saved.Loaded == true)
            {
                //Load ChessBoard
                if (saved.GameMode == eGameMode.VsComputer)
                {
                    CreateChessBoard(saved.OwnSide, saved.GameMode, saved.GameDifficulty, saved.SaveThisState);
                }
                else
                {
                    CreateChessBoard(saved.OwnSide, saved.GameMode, saved.SaveThisState);
                }

                board.GameStatus               = saved.GameStatus;
                board.GameStatusReason         = saved.GameStatusReason;
                board.WhoTurn                  = saved.WhoTurn;
                board.arrWhoCheck              = saved.arrWhoCheck;
                board.stkUndo                  = saved.stkUndo;
                board.stkRedo                  = saved.stkRedo;
                board.stkChessMoveString       = saved.stkChessMoveString;
                board.clear_Stack_Redo         = saved.Clear_Stack_Redo;
                Uc_ChessBoard.PositionLastMove = new Point(saved.PositionLastMove.X, saved.PositionLastMove.Y);
                board.PositionChoosen          = new Point(saved.PositionChoosen.X, saved.PositionChoosen.Y);
                board.arrPosition              = saved.arrPosition;
                board.stkChessPieceEated       = saved.stkChessPieceEated;
                ucChessPieceEated1.LoadChessPieces(board.stkChessPieceEated);
                ucChessPieceEated2.LoadChessPieces(board.stkChessPieceEated);

                //Load Timer
                ucCountDownTimer1.Min = saved.Min1;
                ucCountDownTimer1.Sec = saved.Sec1;
                ucCountDownTimer1.TimeBonus(0);
                ucCountDownTimer2.Min = saved.Min2;
                ucCountDownTimer2.Sec = saved.Sec2;
                ucCountDownTimer2.TimeBonus(0);
            }
        }