Phase 8 : ajout des murs
This commit is contained in:
parent
65134fcca9
commit
33204404f6
4 changed files with 26 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
|||
package controleur;
|
||||
import modele.Jeu;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import controleur.GLOBAL;
|
||||
import modele.JeuClient;
|
||||
import modele.JeuServeur;
|
||||
|
|
@ -89,6 +92,15 @@ public class Controle implements AsyncResponse {
|
|||
case "ajout mur":
|
||||
this.frmArene.ajoutMurs(info);
|
||||
break;
|
||||
case "ajout panel murs":
|
||||
leJeu.envoi((Connection)info, this.frmArene.jpnMurs());
|
||||
}
|
||||
}
|
||||
|
||||
public void evenementJeuClient(String ordre, Object info) {
|
||||
switch(ordre) {
|
||||
case "mettre murs":
|
||||
this.frmArene.setJpnMurs((JPanel)info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package modele;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import controleur.Controle;
|
||||
import outils.connexion.Connection;
|
||||
|
||||
|
|
@ -26,6 +28,9 @@ public class JeuClient extends Jeu {
|
|||
|
||||
@Override
|
||||
public void reception(Connection connection, Object info) {
|
||||
if(info instanceof JPanel) {
|
||||
controle.evenementJeuClient("mettre murs", info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class JeuServeur extends Jeu {
|
|||
String splitted[] = ((String)info).split(GLOBAL.separateur);
|
||||
switch(splitted[0]) {
|
||||
case "pseudo":
|
||||
controle.evenementJeuServeur("ajout panel murs", connection);
|
||||
String pseudo = splitted[1];
|
||||
int numPerso = Integer.parseInt(splitted[2]);
|
||||
this.lesJoueurs.get(connection).initPerso(pseudo, numPerso);
|
||||
|
|
|
|||
|
|
@ -87,4 +87,12 @@ public class Arene extends JFrame {
|
|||
jpnMur.add((JLabel)portougal);
|
||||
jpnMur.repaint();
|
||||
}
|
||||
public JPanel jpnMurs() {
|
||||
return jpnMur;
|
||||
}
|
||||
|
||||
public void setJpnMurs(JPanel jpnMurs) {
|
||||
this.jpnMur.add(jpnMurs);
|
||||
this.jpnMur.repaint();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue