示例#1
0
        public GameVM()
        {
            InitialGameStatus = new GameStatusVM(System.IO.Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName + "/Resources/SatrtGame.txt");

            Board = Helper.ConvertIntegerMatrixToSquareMatrix(InitialGameStatus.Status.GameBoard);

            bl = new GameBusinessLogic(Board);

            GameBusinessLogic.CurrentPlayer = (Type)InitialGameStatus.Status.CurrentPlayer;

            GameBusinessLogic.NumberOfRedPieces = InitialGameStatus.Status.NumberOfRedPieces;

            GameBusinessLogic.NumberOfBlackPieces = InitialGameStatus.Status.NumberOfBlackPieces;

            GameBoard = Helper.CellBoardToCellVMBoard(Board, bl);
        }
示例#2
0
        public static void RestoreGame(string path)
        {
            GameStatusVM status = new GameStatusVM(path);

            Board = Helper.ConvertIntegerMatrixToSquareMatrix(status.Status.GameBoard);

            for (int line = 0; line < BOARD_DIMMENSION; line++)
            {
                for (int column = 0; column < BOARD_DIMMENSION; column++)
                {
                    GameBoard[line][column].SimpleSquare.Type = Board[line][column].Type;
                }
            }
            GameBusinessLogic.CurrentPlayer = (Type)status.Status.CurrentPlayer;

            GameBusinessLogic.NumberOfRedPieces = status.Status.NumberOfRedPieces;

            GameBusinessLogic.NumberOfBlackPieces = status.Status.NumberOfBlackPieces;
        }