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); } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { // save game state PuzzleState gameState = this.game.GetState(); IsolatedStorageHelper.SaveObject("PuzzleState", gameState); }
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); } }
public void SetState(PuzzleState state) { }