refactor: remove view import from model
This commit is contained in:
@@ -15,7 +15,6 @@ import org.Models.Pieces.PieceO;
|
||||
import org.Models.Pieces.PieceS;
|
||||
import org.Models.Pieces.PieceT;
|
||||
import org.Models.Pieces.PieceZ;
|
||||
import org.Views.VueGameOver;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Jeu extends Observable implements Runnable {
|
||||
@@ -102,10 +101,7 @@ public class Jeu extends Observable implements Runnable {
|
||||
public boolean estFinPartie() {
|
||||
for (Point caseColoree : this.grille.motifPieceCouranteColoriee()) {
|
||||
if (this.grille.getCase(caseColoree.y, caseColoree.x)) {
|
||||
new VueGameOver(grille.getScore(), e -> System.exit(0), () -> {
|
||||
System.out.println("\"rejouer\"clique");
|
||||
reinitialiserPartie();
|
||||
});
|
||||
finPartie();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,15 @@ public class VueGrille extends JPanel implements Observer, Runnable {
|
||||
updateGrille();
|
||||
}
|
||||
|
||||
if (o instanceof Jeu && !afficherFenetreFinPartie) {
|
||||
if (!this.jeu.jeuEnCours) {
|
||||
if (o instanceof Jeu) {
|
||||
Jeu jeu = (Jeu) o;
|
||||
if (!jeu.jeuEnCours && !afficherFenetreFinPartie) {
|
||||
afficherFenetreFinPartie = true;
|
||||
new VueGameOver(
|
||||
jeu.getGrille().getScore(),
|
||||
e -> System.exit(0),
|
||||
() -> jeu.reinitialiserPartie()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user