From 451ea3c01e34b58a97685d323e9ee7780071363c Mon Sep 17 00:00:00 2001 From: flavien Date: Sat, 18 May 2019 22:02:48 +0200 Subject: [PATCH] added creerObjetsAVendre(Labyrinthe lab) --- .../src/modeles/Generateur.java | 4 +-- .../PROJET-PMT_STRI1A/src/modeles/Marche.java | 4 +-- JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java | 15 +++++++++++ JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java | 2 ++ JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java | 20 ++++++++++++++ JAVA/PROJET-PMT_STRI1A/src/test/Test.java | 27 ------------------- 6 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java delete mode 100644 JAVA/PROJET-PMT_STRI1A/src/test/Test.java diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Generateur.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Generateur.java index b499748..f0f668c 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Generateur.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Generateur.java @@ -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); diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java index 60d7e50..9b7a379 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Marche.java @@ -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++; } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java index 200b3db..9c20fe8 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java @@ -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; + } + + } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java index 66c6047..2d4d50f 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java @@ -47,4 +47,6 @@ public class Salle { public List getListePorte() { return this.listePorte; } + + } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java new file mode 100644 index 0000000..7e4f070 --- /dev/null +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Test.java @@ -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)); + } + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/test/Test.java b/JAVA/PROJET-PMT_STRI1A/src/test/Test.java deleted file mode 100644 index 8c9eb63..0000000 --- a/JAVA/PROJET-PMT_STRI1A/src/test/Test.java +++ /dev/null @@ -1,27 +0,0 @@ -package test; - -/** - * @author flavien - * - */ -public class Test { - - public void main() { - - Menu menu = new Menu; - - - - - - - - - - - - - - } - -}