Ajout GSON v0.1 à finir de debug
This commit is contained in:
parent
61fec1a10b
commit
6611a5b65f
28
JAVA/PROJET-PMT_STRI1A/bin/.classpath
Normal file
28
JAVA/PROJET-PMT_STRI1A/bin/.classpath
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry excluding="src/" kind="src" path=""/>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/gson">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="/home/nicolas/Téléchargements"/>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/nicolas/Téléchargements/gson-2.8.5.jar">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/nicolas/Bureau/java-json.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
JAVA/PROJET-PMT_STRI1A/bin/.project
Normal file
17
JAVA/PROJET-PMT_STRI1A/bin/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>projet</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=10
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=10
|
BIN
JAVA/PROJET-PMT_STRI1A/bin/java-json.jar
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/java-json.jar
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/json/gsonGenerator.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/json/gsonGenerator.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/json/main.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/json/main.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Arme.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Arme.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Armure.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Armure.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Bourse.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Bourse.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Clavier.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Clavier.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/EtreVivant.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/EtreVivant.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Labyrinthe.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Labyrinthe.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Marche.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Marche.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Monstre.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Monstre.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Objet.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Objet.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Personnage.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Personnage.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Porte.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Porte.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Potion.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Potion.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Salle.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Salle.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Snippet.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/Snippet.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/parseurJson.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/parseurJson.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/sauvegarde.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/modeles/sauvegarde.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/module-info.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/module-info.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/bin/test/Test.class
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/bin/test/Test.class
Normal file
Binary file not shown.
BIN
JAVA/PROJET-PMT_STRI1A/src/java-json.jar
Normal file
BIN
JAVA/PROJET-PMT_STRI1A/src/java-json.jar
Normal file
Binary file not shown.
28
JAVA/PROJET-PMT_STRI1A/src/json/gsonGenerator.java
Normal file
28
JAVA/PROJET-PMT_STRI1A/src/json/gsonGenerator.java
Normal file
@ -0,0 +1,28 @@
|
||||
package json;
|
||||
import modeles.*;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class gsonGenerator {
|
||||
String chaineJson;
|
||||
|
||||
/**
|
||||
* @param chaineJson
|
||||
*/
|
||||
public gsonGenerator() {
|
||||
|
||||
|
||||
}
|
||||
/*chaine json =
|
||||
"{'positionX':0,
|
||||
'positionY':0,
|
||||
'sortie':false,
|
||||
'monstre':[{'nom':premier monstre,'pAttaque':5}],
|
||||
'porte':[{'ouvert':=true, 'position':"H"}]}"
|
||||
*/
|
||||
public void generate(String chaine) {
|
||||
Gson gson = new Gson();
|
||||
Salle salle = gson.fromJson(chaine, Salle.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
16
JAVA/PROJET-PMT_STRI1A/src/json/main.java
Normal file
16
JAVA/PROJET-PMT_STRI1A/src/json/main.java
Normal file
@ -0,0 +1,16 @@
|
||||
package json;
|
||||
|
||||
|
||||
import modeles.Monstre;
|
||||
|
||||
public class main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
gsonGenerator generateur = new gsonGenerator();
|
||||
Monstre monstr = new Monstre("test", 5);
|
||||
String chaine = "{'positionX':0,'positionY':0,'sortie':false,'monstre':[{'nom':'premier monstre','pAttaque':5}],'porte':[{'ouvert':true, 'position':'H'}]}";
|
||||
generateur.generate(chaine);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,8 @@ package modeles;
|
||||
* @author flavien
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
public class Arme extends Objet {
|
||||
|
||||
private int pArme;
|
||||
@ -22,5 +24,5 @@ public class Arme extends Objet {
|
||||
this.pArme=attaque;
|
||||
}
|
||||
|
||||
/* public void effectArme ? (poison, incinération, gel, saignement, paralysie,... */
|
||||
/* public void effectArme ? (poison, incin<EFBFBD>ration, gel, saignement, paralysie,... */
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class EtreVivant {
|
||||
protected int pVieMax;
|
||||
protected int pVie;
|
||||
private int pAttaque;
|
||||
protected Salle salle;
|
||||
//protected Salle salle;
|
||||
private boolean vivant;
|
||||
/**
|
||||
* @param nom
|
||||
@ -24,13 +24,13 @@ public class EtreVivant {
|
||||
* @param salle
|
||||
* @param vivant
|
||||
*/
|
||||
public EtreVivant(String nom, int pVieMax, int pAttaque, Salle salle) {
|
||||
public EtreVivant(String nom, int pVieMax, int pAttaque) {
|
||||
super();
|
||||
this.nom = nom;
|
||||
this.pVieMax = pVieMax;
|
||||
this.pVie = pVieMax;
|
||||
this.pAttaque = pAttaque;
|
||||
this.salle = salle;
|
||||
|
||||
this.vivant = true;
|
||||
}
|
||||
/**
|
||||
@ -80,16 +80,15 @@ public class EtreVivant {
|
||||
}
|
||||
/**
|
||||
* @return the salle
|
||||
*/
|
||||
|
||||
public Salle getSalle() {
|
||||
return salle;
|
||||
}
|
||||
/**
|
||||
* @param salle the salle to set
|
||||
*/
|
||||
|
||||
public void setSalle(Salle salle) {
|
||||
this.salle = salle;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* @return the vivant
|
||||
*/
|
||||
|
@ -3,10 +3,17 @@
|
||||
*/
|
||||
package modeles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author flavien
|
||||
*
|
||||
*/
|
||||
public class Marche extends Salle {
|
||||
|
||||
public Marche(int positionX, int positionY, boolean sortie, List listeEnnemie, List listePorte) {
|
||||
super(positionX, positionY, sortie, listeEnnemie, listePorte);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ public class Monstre extends EtreVivant {
|
||||
* @param armure
|
||||
* @param bourse
|
||||
*/
|
||||
public Monstre(String nom, int pAttaque, Salle salle) {
|
||||
super(nom, 5, pAttaque, salle);
|
||||
public Monstre(String nom, int pAttaque) {
|
||||
super(nom, 5, pAttaque);
|
||||
|
||||
}
|
||||
public int attaquer(Personnage def) {
|
||||
|
@ -8,8 +8,8 @@ public class Personnage extends EtreVivant {
|
||||
private Arme arme;
|
||||
private Armure armure;
|
||||
private Bourse bourse;
|
||||
public Personnage(String nom, int pVieMax,int pAttaque, Salle salle) {
|
||||
super(nom, pVieMax, pAttaque, salle);
|
||||
public Personnage(String nom, int pVieMax,int pAttaque) {
|
||||
super(nom, pVieMax, pAttaque);
|
||||
}
|
||||
|
||||
public void equiper(Arme arme) {
|
||||
@ -27,9 +27,11 @@ public void equiper(Armure armure) {
|
||||
System.out.println("Pv au maximum");
|
||||
potion.utilisation();
|
||||
}
|
||||
/*
|
||||
public void seDeplacer(Salle salle) {
|
||||
this.salle=salle;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public int attaquer(Monstre monstre) {
|
||||
|
@ -19,7 +19,7 @@ public class Salle {
|
||||
* @param listeEnnemie
|
||||
* @param listePorte
|
||||
*/
|
||||
public Salle(int positionX, int positionY, boolean sortie, List<Monstre> listeEnnemie, List<Porte> listePorte) {
|
||||
public Salle(int positionX, int positionY, boolean sortie, List listeEnnemie, List listePorte) {
|
||||
this.positionX = positionX;
|
||||
this.positionY = positionY;
|
||||
this.sortie = sortie;
|
||||
|
@ -17,9 +17,9 @@ public class sauvegarde {
|
||||
+ "\n\t \"pVieMax\" : \""+lab.listePersonnage.get(i).getPvMax()
|
||||
+"\" ,\n\t \"pVie\" : \""+lab.listePersonnage.get(i).getpVie()
|
||||
+"\" ,\n\t \"pAttaque\" : \""+lab.listePersonnage.get(i).getpAttaque()
|
||||
+"\" ,\n\t \"salle\" : \""+lab.listePersonnage.get(i).getSalle().getPositionX()+" "+lab.listePersonnage.get(i).getSalle().getPositionY() /*attention pour la récupération de sauvegarde*/
|
||||
//+"\" ,\n\t \"salle\" : \""+lab.listePersonnage.get(i).getSalle().getPositionX()+" "+lab.listePersonnage.get(i).getSalle().getPositionY() /*attention pour la r<EFBFBD>cup<EFBFBD>ration de sauvegarde*/
|
||||
+"\" ,\n\t \"vivant\" : \""+lab.listePersonnage.get(i).isVivant() +"\n\t \"arme\" : \""+lab.listePersonnage.get(i).getArme().getNom()
|
||||
+"\" ,\n\t \"armure\" : \""+lab.listePersonnage.get(i).getArmure().getNom() +"\n\t \"bourse\" : \""+lab.listePersonnage.get(i).getBourse().getValeur()+"\n}"); /* attention pour la récupération de donnée */
|
||||
+"\" ,\n\t \"armure\" : \""+lab.listePersonnage.get(i).getArmure().getNom() +"\n\t \"bourse\" : \""+lab.listePersonnage.get(i).getBourse().getValeur()+"\n}"); /* attention pour la r<EFBFBD>cup<EFBFBD>ration de donn<6E>e */
|
||||
}
|
||||
fw.flush();
|
||||
fw.close();
|
||||
@ -28,7 +28,7 @@ public class sauvegarde {
|
||||
}
|
||||
}
|
||||
/*
|
||||
public void enregistrerLabyrinthe(Labyrinthe lab) { // à faire
|
||||
public void enregistrerLabyrinthe(Labyrinthe lab) { // <EFBFBD> faire
|
||||
try {
|
||||
File f = new File ("./labyrinthe.json");
|
||||
f.createNewFile();
|
||||
|
11
JAVA/PROJET-PMT_STRI1A/src/module-info.java
Normal file
11
JAVA/PROJET-PMT_STRI1A/src/module-info.java
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
module projet {
|
||||
requires gson;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user