Example #1
0
        public void SetState(PuzzleState state)
        {
            this.board       = state.Board;
            this.totalMoves  = state.TotalMoves;
            this.isPlaying   = state.IsPlaying;
            this.colsAndRows = state.ColsAndRows;

            var totalPieces = this.colsAndRows * this.colsAndRows;

            for (int n = 0; n < totalPieces; n++)
            {
                int nx = n / colsAndRows;
                int ny = n % colsAndRows;
                if (this.board[n] >= 0)
                {
                    this.InvokePieceUpdated(this.board[n], new Point(nx, ny));
                }
            }

            this.CheckWinner();
            if (this.isPlaying && this.GameStarted != null)
            {
                this.GameStarted(this, null);
            }
        }
Example #2
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            // save game state
            PuzzleState gameState = this.game.GetState();

            IsolatedStorageHelper.SaveObject("PuzzleState", gameState);
        }
Example #3
0
        public void SetState(PuzzleState state)
        {
            this.board = state.Board;
            this.totalMoves = state.TotalMoves;
            this.isPlaying = state.IsPlaying;
            this.colsAndRows = state.ColsAndRows;

            var totalPieces = this.colsAndRows * this.colsAndRows;
            for (int n = 0; n < totalPieces; n++)
            {
                int nx = n / colsAndRows;
                int ny = n % colsAndRows;
                if (this.board[n] >= 0)
                {
                    this.InvokePieceUpdated(this.board[n], new Point(nx, ny));
                }
            }

            this.CheckWinner();
            if (this.isPlaying && this.GameStarted != null)
            {
                this.GameStarted(this, null);
            }
        }
Example #4
0
 public void SetState(PuzzleState state)
 {
 }