Commit 1fa4b739 authored by Jolan RENOUX's avatar Jolan RENOUX
Browse files

maj appp7

parent d6f9e4cb
...@@ -17,21 +17,21 @@ import java.util.ArrayList; ...@@ -17,21 +17,21 @@ import java.util.ArrayList;
public class Application { public class Application {
//http://37.187.38.219/api/v0 //http://37.187.38.219/api/v0 iut et vpn
//http://172.26.82.18//api/v0 //http://172.26.82.18//api/v0 hors iut
private static String url = "http://37.187.38.219/api/v0"; private static String url = "http://37.187.38.219/api/v0";
private static String proxy = "srv-proxy-etu-2.iut-nantes.univ-nantes.prive"; private static String proxy = "srv-proxy-etu-2.iut-nantes.univ-nantes.prive";
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
boolean done = true;
Player jaquie; Player jaquie;
int valtouche; int valtouche;
Game jeu = null; Game jeu = null;
try { jeu = new Game(0); } catch (BadIdException e) { e.printStackTrace();} try { jeu = new Game(0); } catch (BadIdException e) { e.printStackTrace();}
//affichage de la fenetre de connection
PremiereFenetre pf = new PremiereFenetre(); PremiereFenetre pf = new PremiereFenetre();
//connection au proxy //connection au proxy
...@@ -39,25 +39,25 @@ public class Application { ...@@ -39,25 +39,25 @@ public class Application {
Network.enableProxy(true); Network.enableProxy(true);
/*
NavyFleet fleet = new NavyFleet(); //flotte de test (le serveur ne vérifie pas la conformité belge/france juste qu'elle soit pleine
/* flotte de test NavyFleet fleet2 = new NavyFleet();
try { try {
fleet.add(new AircraftCarrier("porteavion1","A1","A6")); fleet2.add(new AircraftCarrier("porteavion1","A1","A5"));
fleet.add(new AircraftCarrier("porteavion2","B1","B6")); fleet2.add(new AircraftCarrier("porteavion2","B1","B5"));
fleet.add(new AircraftCarrier("porteavion3","C1","C6")); fleet2.add(new AircraftCarrier("porteavion3","C1","C5"));
fleet.add(new AircraftCarrier("porteavion4","D1","D6")); fleet2.add(new AircraftCarrier("porteavion4","D1","D5"));
} catch (BadCoordException | CoordsBadShipException e) {e.printStackTrace();} } catch (BadCoordException | CoordsBadShipException e) {e.printStackTrace();}
*/ */
//on attend une réponse du coté ihm, la validation que la flotte et le pseudo sont créés et conforme pour les récupérer
while(pf.fc.isValider()){Thread.sleep(500);} while(pf.fc.isValider()){Thread.sleep(500);}
jaquie = new Player(pf.fc.getPseudo()); jaquie = new Player(pf.fc.getPseudo());
System.out.println(jaquie.getName()); System.out.println(jaquie.getName());
fleet = pf.fc.getFlotte(); NavyFleet fleet = pf.fc.getFlotte();
//TODO IHM : combobox avec cette liste
boolean done = true;
while (done) { while (done) {
if (pf.fc.getChoix() == 1) { if (pf.fc.getChoix() == 1) {
//rejoindre //rejoindre
...@@ -73,6 +73,8 @@ public class Application { ...@@ -73,6 +73,8 @@ public class Application {
} else if (pf.fc.getChoix() == 2) { } else if (pf.fc.getChoix() == 2) {
//creer partie //creer partie
System.out.println("CREER PARTIE"); System.out.println("CREER PARTIE");
System.out.println(fleet);
System.out.println(jaquie.getName());
try { try {
jeu = Network.initNewGame(url,jaquie,fleet); jeu = Network.initNewGame(url,jaquie,fleet);
} }
...@@ -106,7 +108,7 @@ public class Application { ...@@ -106,7 +108,7 @@ public class Application {
while(partie_bool){ while(partie_bool){
try { try {
System.out.println(jeu); System.out.println(jeu);
info = Network.getInfo("http://172.26.82.18//api/v0",jeu,jaquie); info = Network.getInfo(url,jeu,jaquie);
System.out.println(info); System.out.println(info);
} catch (UnirestException | BadIdException e) { e.printStackTrace(); } } catch (UnirestException | BadIdException e) { e.printStackTrace(); }
switch (info){ switch (info){
...@@ -120,11 +122,12 @@ public class Application { ...@@ -120,11 +122,12 @@ public class Application {
System.out.println("10 c'est au joueur courant de jouer"); System.out.println("10 c'est au joueur courant de jouer");
while (FenetreJeux.getCoco() != null) { while (FenetreJeux.getCoco() != null) {
try { try {
valtouche = Network.playOneTurn("http://172.26.82.18//api/v0", jeu, jaquie, FenetreJeux.getCoco()); valtouche = Network.playOneTurn(url, jeu, jaquie, FenetreJeux.getCoco());
while (valtouche==-10) { while (valtouche==-10) {
Network.playOneTurn("http://172.26.82.18//api/v0", jeu, jaquie, FenetreJeux.getCoco()); Network.playOneTurn(url, jeu, jaquie, FenetreJeux.getCoco());
Thread.sleep(400); Thread.sleep(400);
} }
FenetreJeux.setValtouche(valtouche);
} catch (UnirestException | BadCoordException e) { e.printStackTrace();} } catch (UnirestException | BadCoordException e) { e.printStackTrace();}
} }
break; break;
......
...@@ -297,7 +297,7 @@ public class FenetreConnexion extends JFrame { ...@@ -297,7 +297,7 @@ public class FenetreConnexion extends JFrame {
envoyepseudo.setEnabled(false); envoyepseudo.setEnabled(false);
france.setEnabled(true); france.setEnabled(true);
belgique.setEnabled(false); belgique.setEnabled(false);
textePays.setText("Bateau de la france\n1 cuirassé, 2 croiseurs\n3 Torpilleur, 4 Sous-marins"); textePays.setText("Bateaux de la Belgique:\n1 cuirassé, 2 croiseurs\n3 Torpilleur, 4 Sous-marins");
pays[0] = 4; pays[1] = 3; pays[2] = 2; pays[3] = 1; pays[4] = 0; pays[0] = 4; pays[1] = 3; pays[2] = 2; pays[3] = 1; pays[4] = 0;
for(int i=0;i<100;i++){ for(int i=0;i<100;i++){
bouttons[i].getButton().setBackground(Color.WHITE); bouttons[i].getButton().setBackground(Color.WHITE);
......
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