You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
841 B
Java
29 lines
841 B
Java
package modeles;
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileReader;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
public class Generateur {
|
|
|
|
public Labyrinthe labyrithe() {
|
|
BufferedReader bfr= null;
|
|
try {
|
|
bfr = new BufferedReader(new FileReader("C:\\Users\\theo\\Documents\\Java\\Projet\\javaProject\\src\\modeles\\lab.json"));
|
|
} catch (FileNotFoundException e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
//FileReader file = new FileReader(json);
|
|
Gson gson = new Gson();
|
|
//String str="{\"positionX\":0,\"positionY\":0,\"sortie\":false,\"monstre\":[{\"nom\":\"premier monstre\",\"pAttaque\":5}],\"porte\":[{\"ouvert\":true, \"position\":\"H\"}]}";
|
|
Labyrinthe labyrithe = gson.fromJson(bfr, Labyrinthe.class);
|
|
return labyrithe;
|
|
}
|
|
|
|
|
|
}
|