added creerObjetsAVendre(Labyrinthe lab)
This commit is contained in:
parent
e3a59197c0
commit
451ea3c01e
@ -17,7 +17,7 @@ public class Generateur {
|
|||||||
public Labyrinthe labyrinthe() {
|
public Labyrinthe labyrinthe() {
|
||||||
BufferedReader bfr= null;
|
BufferedReader bfr= null;
|
||||||
try {
|
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) {
|
} catch (FileNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -34,7 +34,7 @@ public class Generateur {
|
|||||||
String str = gson.toJson(lab);
|
String str = gson.toJson(lab);
|
||||||
System.out.println(str);
|
System.out.println(str);
|
||||||
try {
|
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();
|
file.createNewFile();
|
||||||
FileWriter writer = new FileWriter(file);
|
FileWriter writer = new FileWriter(file);
|
||||||
|
|||||||
@ -24,13 +24,13 @@ public class Marche extends Salle {
|
|||||||
|
|
||||||
for (Arme arme : lab.listeArme) {
|
for (Arme arme : lab.listeArme) {
|
||||||
//stringifier les armes
|
//stringifier les armes
|
||||||
listeSarme += arme.toString() + " au prix de : " + arme.getPrix()"\n";
|
listeSarme += arme.toString() + " au prix de : " + arme.getPrix()+ "\n";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Armure armure : lab.listeArmure) {
|
for (Armure armure : lab.listeArmure) {
|
||||||
//stringifier les armures
|
//stringifier les armures
|
||||||
listeSarmure += armure.toString()+ " au prix de : " + armure.getPrix()"\n";
|
listeSarmure += armure.toString()+ " au prix de : " + armure.getPrix() + "\n";
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,5 +40,20 @@ public class Porte {
|
|||||||
return this.id;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,4 +47,6 @@ public class Salle {
|
|||||||
public List<Integer> getListePorte() {
|
public List<Integer> getListePorte() {
|
||||||
return this.listePorte;
|
return this.listePorte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java
Normal file
20
JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java
Normal 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,27 +0,0 @@
|
|||||||
package test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author flavien
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
public void main() {
|
|
||||||
|
|
||||||
Menu menu = new Menu;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user