|
|
@ -127,11 +127,23 @@ public class Playfield { |
|
|
|
public void cellFlooded() { |
|
|
|
cellsFlooded++; |
|
|
|
if (cellsFlooded >= Size * Size - bombAmount) { |
|
|
|
revealAllBombs(); |
|
|
|
JOptionPane.showMessageDialog(MsG, "You won, congratulations!"); |
|
|
|
reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void revealAllBombs() { |
|
|
|
for (int i = 0; i < Size; i++) { |
|
|
|
for (int j = 0; j < Size; j++) { |
|
|
|
if(cells[i][j].type == CellType.Bomb) { |
|
|
|
cells[i][j].reveal(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
MsG.repaint(); |
|
|
|
} |
|
|
|
|
|
|
|
public void cellDried() { |
|
|
|
cellsFlooded--; |
|
|
|
} |