Fix erreur de push
This commit is contained in:
parent
3385e4cecb
commit
a33bba5a6e
@ -1,5 +1,5 @@
|
|||||||
package json;
|
package json;
|
||||||
import modeles.*;
|
import modeles.Salle;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
public class gsonGenerator {
|
public class gsonGenerator {
|
||||||
@ -19,9 +19,11 @@ public class gsonGenerator {
|
|||||||
'monstre':[{'nom':premier monstre,'pAttaque':5}],
|
'monstre':[{'nom':premier monstre,'pAttaque':5}],
|
||||||
'porte':[{'ouvert':=true, 'position':"H"}]}"
|
'porte':[{'ouvert':=true, 'position':"H"}]}"
|
||||||
*/
|
*/
|
||||||
public void generate(String chaine) {
|
public Salle generate(String chaine) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Salle salle = gson.fromJson(chaine, Salle.class);
|
Salle salle = gson.fromJson(chaine, Salle.class);
|
||||||
|
System.out.println(salle.estVide());
|
||||||
|
return salle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,9 @@ public class EtreVivant {
|
|||||||
* @param salle
|
* @param salle
|
||||||
* @param vivant
|
* @param vivant
|
||||||
*/
|
*/
|
||||||
|
public EtreVivant() {
|
||||||
|
|
||||||
|
}
|
||||||
public EtreVivant(String nom, int pVieMax, int pAttaque) {
|
public EtreVivant(String nom, int pVieMax, int pAttaque) {
|
||||||
super();
|
super();
|
||||||
this.nom = nom;
|
this.nom = nom;
|
||||||
|
|||||||
@ -17,6 +17,9 @@ public class Monstre extends EtreVivant {
|
|||||||
public Monstre(String nom, int pAttaque) {
|
public Monstre(String nom, int pAttaque) {
|
||||||
super(nom, 5, pAttaque);
|
super(nom, 5, pAttaque);
|
||||||
|
|
||||||
|
}
|
||||||
|
public Monstre() {
|
||||||
|
|
||||||
}
|
}
|
||||||
public int attaquer(Personnage def) {
|
public int attaquer(Personnage def) {
|
||||||
int pAttaqueLoc;
|
int pAttaqueLoc;
|
||||||
|
|||||||
@ -11,6 +11,10 @@ public class Porte {
|
|||||||
private boolean ouvert;
|
private boolean ouvert;
|
||||||
private char orientation;
|
private char orientation;
|
||||||
|
|
||||||
|
public Porte() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Porte(boolean ouvert, char orientation) {
|
public Porte(boolean ouvert, char orientation) {
|
||||||
super();
|
super();
|
||||||
this.ouvert = ouvert;
|
this.ouvert = ouvert;
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package modeles;
|
package modeles;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -11,7 +9,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Salle {
|
public class Salle {
|
||||||
private int positionX;
|
public static int positionX;
|
||||||
/**
|
/**
|
||||||
* @param positionX
|
* @param positionX
|
||||||
* @param positionY
|
* @param positionY
|
||||||
@ -19,28 +17,33 @@ public class Salle {
|
|||||||
* @param listeEnnemie
|
* @param listeEnnemie
|
||||||
* @param listePorte
|
* @param listePorte
|
||||||
*/
|
*/
|
||||||
public Salle(int positionX, int positionY, boolean sortie, List listeEnnemie, List listePorte) {
|
|
||||||
|
public Salle(int positionX, int positionY, boolean sortie, List listeEnnemie, List<Porte> listePorte) {
|
||||||
this.positionX = positionX;
|
this.positionX = positionX;
|
||||||
this.positionY = positionY;
|
this.positionY = positionY;
|
||||||
this.sortie = sortie;
|
this.sortie = sortie;
|
||||||
this.listeEnnemie = listeEnnemie;
|
this.listeEnnemie = listeEnnemie;
|
||||||
this.listePorte = listePorte;
|
this.listePorte = listePorte;
|
||||||
}
|
}
|
||||||
|
public Salle() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int positionY;
|
||||||
|
private static boolean sortie;
|
||||||
|
private static List<Monstre> listeEnnemie= new ArrayList<Monstre>();
|
||||||
|
private static List<Porte> listePorte = new ArrayList<Porte>();
|
||||||
|
|
||||||
private int positionY;
|
|
||||||
private boolean sortie;
|
|
||||||
private List<Monstre> listeEnnemie= new ArrayList<Monstre>();
|
|
||||||
private List<Porte> listePorte = new ArrayList<Porte>();
|
|
||||||
public String getType(){
|
public String getType(){
|
||||||
return "salle";
|
return "salle";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPositionX() {
|
public int getPositionX() {
|
||||||
return this.positionX;
|
return positionX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPositionY() {
|
public int getPositionY() {
|
||||||
return this.positionY;
|
return positionY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean estSortie() {
|
public boolean estSortie() {
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
package modeles;
|
|
||||||
|
|
||||||
public class Snippet {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
org.json }
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
package modeles;
|
|
||||||
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.json.*;
|
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.parser.*;
|
|
||||||
|
|
||||||
import jdk.nashorn.internal.parser.JSONParser;
|
|
||||||
import jdk.nashorn.internal.runtime.JSONListAdapter;
|
|
||||||
public class parseurJson {
|
|
||||||
Object obj = new JSONParser().parse(new FileReader("map.json"));
|
|
||||||
JSONObject = jo = (JSONObject) obj;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -7,5 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
module projet {
|
module projet {
|
||||||
requires gson;
|
requires gson;
|
||||||
|
requires java.sql;
|
||||||
|
opens modeles to gson;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user