/// <summary> /// The request score list. /// </summary> /// <param name="type"> /// The game difficulty type. /// </param> public void RequestScoreList(MinesweeperDifficultyType type) { this.type = type; if (this.ShowScoreBoardEvent != null) { this.ShowScoreBoardEvent.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Initializes a new instance of the <see cref="MinesweeperGameController"/> class. /// </summary> /// /// <param name="gameGrid"> /// The game grid. /// </param> /// <param name="gameView"> /// The game view. /// </param> /// <param name="timer"> /// The timer. /// </param> /// /// <param name="players"> /// The players list. /// </param> /// /// <param name="type"> /// The game's difficulty type. /// </param> public MinesweeperGameController( IMinesweeperGrid gameGrid, IMinesweeperView gameView, IMinesweeperTimer timer, List<MinesweeperPlayer> players, MinesweeperDifficultyType type) { if (gameGrid == null) { throw new ArgumentNullException("gameGrid"); } if (gameView == null) { throw new ArgumentNullException("gameView"); } if (timer == null) { throw new ArgumentNullException("timer"); } if (players == null) { throw new ArgumentNullException("players"); } // Initialize objects this.grid = gameGrid; this.gameView = gameView; this.minesweeperTimer = timer; this.players = players; this.type = type; // Handle all view callbacks this.gameView.OpenCellEvent += this.GameViewOnOpenCellEvent; this.gameView.ProtectCellEvent += this.GameViewOnProtectCellEvent; this.gameView.AddPlayerEvent += this.GameViewOnAddPlayerEvent; this.gameView.ShowScoreBoardEvent += this.GameViewOnShowScoreBoardEvent; // Handle all grid callbacks this.grid.BoomEvent += this.GridOnBoomEvent; this.gameView.DisplayGrid(this.grid); this.isGameStarted = false; }