lancer des

This commit is contained in:
Kruss
2020-05-12 15:36:10 +02:00
21 changed files with 208 additions and 88 deletions

View File

@ -42,7 +42,6 @@ public class ChoisirJoueur implements Initializable{
this.buttons.add(btn6);
this.buttons.add(btn7);
this.buttons.add(btn8);
}
public void initButtons() {

View File

@ -0,0 +1,28 @@
package ihm.controller;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import main.GestionnaireJeu;
public class Dialog implements Initializable {
@FXML private Button button;
@FXML private Label label;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
button.setOnAction(x -> {
GestionnaireJeu.notifyPlateau();
});
}
public void setText(String text) {
this.label.setText(text);
}
}

View File

@ -46,10 +46,13 @@ public class MenuController implements Initializable{
AnchorPane pane = fxmlLoader.load();
Scene scene = new Scene(pane);
Stage appStage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
appStage.setScene(scene);
appStage.show();
double width = appStage.getWidth();
double height = appStage.getHeight();
double X = appStage.getX();
double Y = appStage.getY();
appStage.setScene(scene);
}
@FXML
@ -70,7 +73,7 @@ public class MenuController implements Initializable{
@FXML
public void quitterLappli(MouseEvent mouseEvent) throws IOException{
System.exit(0);
}
}
@FXML

View File

@ -7,21 +7,16 @@ import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import main.Type;
import main.TypeLumiere;
import main.TypeTenebre;
import main.TypeVision;
public class PiocherCarte implements Initializable{
@FXML private Button lumiere;
@FXML private Button vision;
@FXML private Button tenebre;
private Type carte;
//private Type carte;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
lumiere.setOnAction(e ->{
/*lumiere.setOnAction(e ->{
carte = new TypeLumiere();
});
@ -31,10 +26,10 @@ public class PiocherCarte implements Initializable{
tenebre.setOnAction(e -> {
carte = new TypeTenebre();
});
});*/
}
/*
public Type getCarte() {
return carte;
}
}*/
}

View File

@ -15,6 +15,8 @@ import java.util.Set;
import carte.Carte;
import carte.CarteEquipement;
import carte.CarteLieu;
import carte.CartePiochable;
import carte.CartePiochable.Type;
import database.RessourceLoader;
import ihm.EffetSonore;
import ihm.PopUp;
@ -25,6 +27,7 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
@ -36,6 +39,7 @@ import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.transform.Rotate;
import javafx.util.Duration;
import main.Contexte;
import main.GestionnaireJeu;
@ -58,6 +62,8 @@ public class PlateauController implements Initializable {
private Map<Carte,BufferedImage> mapRessourcesCartes;
private Map<String,BufferedImage> mapRessourcesDosCartes;
public static int DICE_SIX = 2;
public static int DICE_QUATRE = 1;
public static int DICE_BOTH = 0;
@ -94,6 +100,7 @@ public class PlateauController implements Initializable {
mapRessourcesCartes = rl.getRessourceCartes();
setMapRessourcesDosCartes(rl.getRessourceDosCartes());
List<CarteLieu> cl = gj.getCartesLieux();
List<ImageView> ivs = this.getLieux();
@ -202,8 +209,6 @@ public class PlateauController implements Initializable {
}
}
private void applyImageLieu(ImageView iv, Image im) {
StackPane sp = (StackPane) iv.getParent();
@ -427,7 +432,6 @@ public class PlateauController implements Initializable {
public void updateVieJoueur(Joueur joueur, int damage) {
JoueurIHM jIHM = getJoueurIHM(joueur);
jIHM.deplacerPionVie(damage);
}
@FXML
@ -468,7 +472,6 @@ public class PlateauController implements Initializable {
public void close () throws IOException {
final URL fxmlURL = PlateauController.class.getResource("/ihm/ressources/Menu.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane pane = fxmlLoader.load();
rootPane.getChildren().setAll(pane);
@ -487,6 +490,50 @@ public class PlateauController implements Initializable {
public void afficherLancerDes(Joueur j, Contexte c) throws IOException {
this.ld=new LancerDes(c);
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(ld.initLancer());
jihm.setZoneJoueur(ld.initLancer());
}
public void afficherLT(Joueur j, CartePiochable cartePiochable) throws IOException {
Image i = getImageCarte(cartePiochable);
ImageView iv = new ImageView(i);
Pane p = new Pane(iv);
PopUp pu = new PopUp(p,"Image");
pu.getStage().focusedProperty().addListener((obs,wasFocused,isNowFocused) -> {
if(!isNowFocused) {
GestionnaireJeu.notifyPlateau();
pu.getStage().hide();
}
});
pu.display();
}
public void afficherVision(Joueur j, CartePiochable cartePiochable) throws IOException {
final URL fxmlURL = getClass().getResource("/ihm/ressources/RecevoirCarte.fxml");
final ResourceBundle bundle = ResourceBundle.getBundle("domaine.properties.langue", Locale.FRANCE);
final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL, bundle);
Pane root = (Pane)fxmlLoader.load();
RecevoirCarte lzj = fxmlLoader.getController();
Image im = getImageCarte(cartePiochable);
lzj.setImageView(im);
lzj.setText("Cachez la carte vision");
JoueurIHM jihm = getJoueurIHM(j);
jihm.setZoneJoueur(root);
}
public Map<String,BufferedImage> getMapRessourcesDosCartes() {
return mapRessourcesDosCartes;
}
public void setMapRessourcesDosCartes(Map<String,BufferedImage> mapRessourcesDosCartes) {
this.mapRessourcesDosCartes = mapRessourcesDosCartes;
}
}

View File

@ -0,0 +1,36 @@
package ihm.controller;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import main.GestionnaireJeu;
public class RecevoirCarte implements Initializable {
@FXML private Button okButton;
@FXML private Label label;
@FXML private ImageView imageView;
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
okButton.setOnAction(x -> {
GestionnaireJeu.notifyPlateau();
});
}
public void setText(String name) {
this.label.setText(name);
}
public void setImageView(Image imageCarte) {
this.imageView.setImage(imageCarte);
}
}