Configuration etc

This commit is contained in:
Paul Gross
2020-04-23 10:28:10 +02:00
parent df68d70f3d
commit 5cc7a5a053
6 changed files with 41 additions and 37 deletions

View File

@ -22,5 +22,10 @@ public class Configuration {
public int getNombreJoueursHumains() {
return nombreJoueursHumains;
}
public List<Joueur> toJoueurs() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -1,6 +1,5 @@
package main;
import java.util.ArrayList;
import java.util.List;
import com.sun.tools.javac.Main;
@ -10,20 +9,23 @@ import effet.Effet;
public class GestionnaireJeu {
private static GestionnaireJeu gj;
private Plateau plateau;
private GestionnaireJeu() {}
public GestionnaireJeu() {
this.plateau = new Plateau(new ArrayList<Joueur>());
}
public static synchronized GestionnaireJeu getGestionnaireJeu(){
if(gj == null){
gj = new GestionnaireJeu();
}
return gj;
}
public static void main(String[] args) {
try {
Main.main(null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -72,7 +74,10 @@ public class GestionnaireJeu {
// TODO Auto-generated method stub
return false;
}
public void setConfiguration(Configuration c) {
List<Joueur> joueurs = c.toJoueurs();
this.plateau = new Plateau(joueurs);
}
}

View File

@ -8,6 +8,7 @@ import java.util.Map;
import carte.CarteLieu;
import effet.Effet;
import personnage.CartePersonnage;
public class Plateau {
@ -30,23 +31,26 @@ public class Plateau {
public Plateau(List<Joueur> joueurs) {
joueurs.forEach(x -> x.setPlateau(this));
this.joueurs = joueurs;
this.lieux = new ArrayList<>();
this.stats = new HashMap<>();
// Initialisation plateau
this.stats.put(NB_HUNTERS, 0);
this.stats.put(NB_SHADOWS, 0);
this.stats.put(NB_NEUTRES, 0);
joueurs.forEach(x -> x.setPlateau(this));
this.stats.put(NB_MORTS, 0);
this.stats.put(NB_MORTS_NEUTRAL, 0);
this.stats.put(NB_MORTS_HUNTER, 0);
this.stats.put(NB_MORTS_SHADOW, 0);
this.stats.put(PARTIE_FINIE, 0);
initCartePersonnage();
// Initialisation plateau
this.stats.put(NB_HUNTERS, 0);
this.stats.put(NB_SHADOWS, 0);
this.stats.put(NB_NEUTRES, 0);

View File

@ -4,23 +4,6 @@ import java.util.List;
public class View{
private static View view;
private View() {}
static {
try {
view = new View();
}catch(Exception e) {
throw new RuntimeException("View Singleton");
}
}
public static View getView() {
return view;
}
public static void initPartie(List<Joueur> joueurs) {
@ -34,8 +17,10 @@ public class View{
}
public void applyConfiguration(GestionnaireJeu gj,Configuration c) {
public static void applyConfiguration(Configuration c) {
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
gj.setConfiguration(c);
}
public List<Joueur> getJoueurs() {