Choisir un effet, IHM et Plateau
This commit is contained in:
parent
0963e6f1c2
commit
1c28ec2459
@ -106,7 +106,6 @@ public class JoueurIHM {
|
||||
iv.fitHeightProperty().bind(gp.heightProperty());
|
||||
iv.fitHeightProperty().bind(gp.heightProperty());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
iv.setOnMouseReleased(release -> {
|
||||
|
@ -27,6 +27,7 @@ import javafx.animation.Timeline;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
@ -559,34 +560,30 @@ public void afficherEffet(Joueur j) throws IOException {
|
||||
return mapRessourcesDosCartes;
|
||||
}
|
||||
|
||||
|
||||
public void setMapRessourcesDosCartes(Map<String,BufferedImage> mapRessourcesDosCartes) {
|
||||
this.mapRessourcesDosCartes = mapRessourcesDosCartes;
|
||||
}
|
||||
|
||||
|
||||
private Action choixAction;
|
||||
|
||||
public void afficherChoisirAction(Joueur joueur, List<Action> list) {
|
||||
|
||||
final URL fxmlURL = getClass().getResource("/ihm/ressources/ChoisirAction.fxml");
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
|
||||
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
|
||||
|
||||
|
||||
List<Button> buttons = new ArrayList<Button>();
|
||||
|
||||
for(Action a : list) {
|
||||
Button button = interpret(a);
|
||||
buttons.add(button);
|
||||
button.setOnAction(x -> {
|
||||
this.choixAction = a;
|
||||
GestionnaireJeu.notifyPlateau();
|
||||
Button button = interpret(a);
|
||||
buttons.add(button);
|
||||
button.setOnAction(x -> {
|
||||
this.choixAction = a;
|
||||
GestionnaireJeu.notifyPlateau();
|
||||
});
|
||||
}
|
||||
|
||||
VBox v = new VBox();
|
||||
v.getChildren().addAll(buttons);
|
||||
|
||||
v.setAlignment(Pos.CENTER);
|
||||
v.setSpacing(20.0);
|
||||
JoueurIHM jihm = getJoueurIHM(joueur);
|
||||
jihm.setZoneJoueur(v);
|
||||
}
|
||||
@ -597,8 +594,14 @@ public void afficherEffet(Joueur j) throws IOException {
|
||||
|
||||
|
||||
private Button interpret(Action a) {
|
||||
|
||||
String styles = "-fx-border-color: #e2e2e2;"+"-fx-border-width: 2;"+
|
||||
"-fx-background-radius: 0;"+"-fx-background-color: #1d1d1d;"+
|
||||
"-fx-text-fill: #d8d8d8;"+"-fx-background-insets: 0 0 0 0, 0, 1, 2;";
|
||||
|
||||
String s = a.toString();
|
||||
Button b = new Button(s);
|
||||
b.setStyle(styles);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,9 @@ public class GestionnaireJeu {
|
||||
}
|
||||
|
||||
public static void notifyPlateau() {
|
||||
|
||||
Thread t = threads.pop();
|
||||
|
||||
synchronized(t) {
|
||||
t.notify();
|
||||
}
|
||||
|
@ -322,8 +322,8 @@ public class Plateau extends Thread{
|
||||
|
||||
while(!attributed) {
|
||||
int roll = sumRolls(currentJoueur);
|
||||
for(CarteLieu cl : lieux) {
|
||||
|
||||
|
||||
for(CarteLieu cl : lieux) {
|
||||
if(cl.coordinatesContains(roll) && currentJoueur.getCarteLieu() != cl){
|
||||
currentJoueur.deplacer(cl);
|
||||
attributed = true;
|
||||
@ -374,19 +374,24 @@ public class Plateau extends Thread{
|
||||
|
||||
private int rollRandom(int nb) {
|
||||
|
||||
int roll = (int) Math.floor(Math.random() * (nb-1))+1;
|
||||
int roll = (int) Math.floor(Math.random() * (nb))+1;
|
||||
System.out.println("roll" + roll);
|
||||
return roll;
|
||||
}
|
||||
|
||||
public int sumRolls(Joueur j)
|
||||
{
|
||||
int roll4 =rollRandom(4);
|
||||
int roll6 = rollRandom(6);
|
||||
int sum = Math.abs(roll4+roll6);
|
||||
int sum = 0;
|
||||
int roll4 = 0;
|
||||
int roll6 = 0;
|
||||
|
||||
roll4 =rollRandom(4);
|
||||
roll6 = rollRandom(6);
|
||||
sum = Math.abs(roll4+roll6);
|
||||
|
||||
gj.rollDice(j, PlateauController.DICE_BOTH, roll4,roll6);
|
||||
return sum;
|
||||
//return Math.abs(roll4+roll6);
|
||||
return 3;
|
||||
//return sum;
|
||||
}
|
||||
|
||||
public List<Joueur> getJoueurs() {
|
||||
@ -403,7 +408,6 @@ public class Plateau extends Thread{
|
||||
{
|
||||
return this.stats.get(key);
|
||||
}else {
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user