Created
June 5, 2017 17:56
-
-
Save aomnes/7b16df6d7c05ba8559427685ffdd0300 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package view.thread; | |
import javax.swing.JOptionPane; | |
import controler.G_Joueur; | |
import view.form.Fenetre; | |
import view.form.FenetreJeu; | |
import javax.swing.*; | |
public class VerifGagnant extends JFrame implements Runnable { | |
public void run() { | |
Boolean running = true; | |
while(running) | |
{ | |
try { | |
// attente 1 seconde | |
Thread.sleep(500); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
System.out.println("Joueur : "+G_Joueur.getListeJoueur().get(0).getColor() +" "+G_Joueur.getListeJoueur().get(0).getColor()); | |
System.out.println("Joueur : "+G_Joueur.getListeJoueur().get(1).getColor() +" "+G_Joueur.getListeJoueur().get(1).getColor()); | |
if(G_Joueur.getListeJoueur().get(0).getBase().getCouleur()==G_Joueur.getListeJoueur().get(1).getColor()) { | |
JOptionPane.showMessageDialog(null, G_Joueur.getListeJoueur().get(1).getNom()+" gagne"); | |
FenetreJeu.gagnant = 1; | |
running = false; | |
//System.exit(0); | |
} | |
else if (G_Joueur.getListeJoueur().get(1).getBase().getCouleur()==G_Joueur.getListeJoueur().get(0).getColor()) { | |
JOptionPane.showMessageDialog(null, G_Joueur.getListeJoueur().get(0).getNom()+" gagne"); | |
FenetreJeu.gagnant = 0; | |
running = false; | |
this.setVisible(false); | |
//System.exit(0); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment