public void ProcessRightClick(CustomizedButton button) { if (button.Text == @"X") { button.Text = ""; _controller.FlagsChanged(++FlagsCount); if (button.Value == "BOMB") { BombsCount++; } } else { button.Text = @"X"; _controller.FlagsChanged(--FlagsCount); if (button.Value == "BOMB") { BombsCount--; } } CheckIfWin(); }
private void ProcessBomb(CustomizedButton button) { button.Text = @"B"; button.Enabled = false; ShowBombs(); _controller.GameOver(); }
public void ProcessLeftClick(CustomizedButton button) { if (button.Value == "BOMB") { ProcessBomb(button); } else { ProcessSafeButton(button); } CheckIfWin(); }
private void ProcessSafeButton(CustomizedButton button) { var x = button.Location.X / ButtonSize - 1; var y = button.Location.Y / ButtonSize - 1; button.Text = button.Value; button.Enabled = false; button.IsVisited = true; if (button.Value == "0") { OpenEmptyNeighbours(x, y); } }
private void CreateMap() { GameButtons = new CustomizedButton[MapBounds, MapBounds]; for (var i = 0; i < GameButtons.GetLength(0); i++) { for (var j = 0; j < GameButtons.GetLength(1); j++) { GameButtons[i, j] = new CustomizedButton { IsVisited = false }; GameButtons[i, j].SetBounds((i + 1) * ButtonSize, (j + 1) * ButtonSize, ButtonSize, ButtonSize); } } _controller.AddMapButton(GameButtons); }