added creerObjetsAVendre(Labyrinthe lab)

This commit is contained in:
Flavien Haas 2019-05-18 22:02:48 +02:00
parent e3a59197c0
commit 451ea3c01e
6 changed files with 41 additions and 31 deletions

View File

@ -17,7 +17,7 @@ public class Generateur {
public Labyrinthe labyrinthe() {
BufferedReader bfr= null;
try {
bfr = new BufferedReader(new FileReader("C:\\Users\\Nicolas\\eclipse-workspace\\Projet_Java\\JAVA\\PROJET-PMT_STRI1A\\src\\json\\lab.json"));
bfr = new BufferedReader(new FileReader("~lab.json"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -34,7 +34,7 @@ public class Generateur {
String str = gson.toJson(lab);
System.out.println(str);
try {
File file = new File("C:\\Users\\Nicolas\\eclipse-workspace\\Projet_Java\\JAVA\\PROJET-PMT_STRI1A\\src\\json\\lab.json");
File file = new File("~lab.json");
file.createNewFile();
FileWriter writer = new FileWriter(file);

View File

@ -24,13 +24,13 @@ public class Marche extends Salle {
for (Arme arme : lab.listeArme) {
//stringifier les armes
listeSarme += arme.toString() + " au prix de : " + arme.getPrix()"\n";
listeSarme += arme.toString() + " au prix de : " + arme.getPrix()+ "\n";
i++;
}
for (Armure armure : lab.listeArmure) {
//stringifier les armures
listeSarmure += armure.toString()+ " au prix de : " + armure.getPrix()"\n";
listeSarmure += armure.toString()+ " au prix de : " + armure.getPrix() + "\n";
j++;
}

View File

@ -40,5 +40,20 @@ public class Porte {
return this.id;
}
/**
* @return the salle1
*/
public Salle getSalle1() {
return salle1;
}
/**
* @param salle1 the salle1 to set
*/
public void setSalle1(Salle salle1) {
this.salle1 = salle1;
}
}

View File

@ -47,4 +47,6 @@ public class Salle {
public List<Integer> getListePorte() {
return this.listePorte;
}
}

View File

@ -0,0 +1,20 @@
package modeles;
/**
* @author flavien
*
*/
public class Test {
public static void main(String[] args) {
Menu menu = new Menu();
Labyrinthe lab;
lab = menu.menuStartGame();
Marche marche = (Marche)lab.listePorte.get(0).getSalle1();
System.out.println(marche.creerObjetsAVendre(lab));
}
}

View File

@ -1,27 +0,0 @@
package test;
/**
* @author flavien
*
*/
public class Test {
public void main() {
Menu menu = new Menu;
}
}