Commit 52d634ce authored by Jamal ATTOU's avatar Jamal ATTOU
Browse files

Jamal : interface finale 0.2

parent 2b107d73
......@@ -26,7 +26,7 @@ public class ListenerMouseJouer implements MouseListener {
int networkrez = Network.playOneTurn("http://37.187.38.219/api/v0", f1.getGame(), f1.getPlayerVues(),lacordo);
while(partieencours){
switch (networkrez){
case -10:
f1.montour(false);
......@@ -36,7 +36,7 @@ public class ListenerMouseJouer implements MouseListener {
break;
case 1:
f1.result("Touché !");
f1.InitialisePlateauAdverse2(((JPanelCoords)e.getSource()).getCoord2());
f1.colorlacase(((JPanelCoords)e.getSource()));
break;
case 10:
f1.result("Touché coulé !");
......@@ -49,7 +49,7 @@ public class ListenerMouseJouer implements MouseListener {
}
}
} catch (BadCoordException | UnirestException badCoordException) {
badCoordException.printStackTrace();
......
......@@ -10,6 +10,16 @@ public class JPanelCoords extends JPanel {
this.x=x;
this.y=y;
}
public JPanelCoords(String coord){
this.x=coord.charAt(0)-64;
if(coord.length()>2){
/*
this.y=coord.substring(1,2)
*/
}
}
public String getCoord(){
String coordonnees = x + String.valueOf(y);
......
......@@ -40,14 +40,13 @@ public class MenuJeu extends JFrame {
public MenuJeu(String titre, NavyFleet flotte) {
super(titre);
creerinterfacejeu(flotte);
this.setPreferredSize(new Dimension(1000, 800));
this.pack();
this.setResizable(false);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setContentPane(creerinterfacejeu(flotte));
this.setContentPane(fenetrejeu);
}
......@@ -93,6 +92,9 @@ public class MenuJeu extends JFrame {
}
public JPanel InitialisePlateauAdverse2(String coord) {
//création plateau :
JPanelCoords lacaserouge = new JPanelCoords(coord);
quadrillage = new ArrayList<JPanelCoords>();
JPanel plateau = new JPanel(new GridLayout(11, 11, 2, 2));
plateau.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
......@@ -414,6 +416,7 @@ public class MenuJeu extends JFrame {
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment