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

maj appp7

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