|
@ -127,11 +127,23 @@ public class Playfield { |
|
|
public void cellFlooded() { |
|
|
public void cellFlooded() { |
|
|
cellsFlooded++; |
|
|
cellsFlooded++; |
|
|
if (cellsFlooded >= Size * Size - bombAmount) { |
|
|
if (cellsFlooded >= Size * Size - bombAmount) { |
|
|
|
|
|
revealAllBombs(); |
|
|
JOptionPane.showMessageDialog(MsG, "You won, congratulations!"); |
|
|
JOptionPane.showMessageDialog(MsG, "You won, congratulations!"); |
|
|
reset(); |
|
|
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() { |
|
|
public void cellDried() { |
|
|
cellsFlooded--; |
|
|
cellsFlooded--; |
|
|
} |
|
|
} |