Voir carte vision
This commit is contained in:
parent
985a085e74
commit
f1a46ada87
@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
|
||||
import condition.Condition;
|
||||
import effet.Effet;
|
||||
import main.GestionnaireJeu;
|
||||
import main.Joueur;
|
||||
|
||||
public class CartePiochable extends CarteCondition implements Serializable{
|
||||
@ -41,6 +42,8 @@ public class CartePiochable extends CarteCondition implements Serializable{
|
||||
* @param j Appel la méthode utiliser de effet sur le joueur j
|
||||
*/
|
||||
public void utiliser(Joueur j) {
|
||||
GestionnaireJeu gj = GestionnaireJeu.getGestionnaireJeu();
|
||||
gj.piocher(j,this);
|
||||
System.out.println("CartePiochable "+this + " Condition : "+this.getCondition()+" Effet : "+this.getEffet()+" Action : "+this.getEffet().getAction());
|
||||
super.utiliser(j);
|
||||
}
|
||||
|
@ -63,6 +63,15 @@ public class PopUp{
|
||||
});
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
return popup;
|
||||
}
|
||||
|
||||
public Scene getScene() {
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
||||
public void display() {
|
||||
|
||||
popup.setScene(scene);
|
||||
|
@ -42,7 +42,6 @@ public class ChoisirJoueur implements Initializable{
|
||||
this.buttons.add(btn6);
|
||||
this.buttons.add(btn7);
|
||||
this.buttons.add(btn8);
|
||||
|
||||
}
|
||||
|
||||
public void initButtons() {
|
||||
|
28
src/ihm/controller/Dialog.java
Normal file
28
src/ihm/controller/Dialog.java
Normal 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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -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;
|
||||
@ -426,7 +430,6 @@ public class PlateauController implements Initializable {
|
||||
public void updateVieJoueur(Joueur joueur, int damage) {
|
||||
JoueurIHM jIHM = getJoueurIHM(joueur);
|
||||
jIHM.deplacerPionVie(damage);
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -467,16 +470,42 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
36
src/ihm/controller/RecevoirCarte.java
Normal file
36
src/ihm/controller/RecevoirCarte.java
Normal 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);
|
||||
}
|
||||
}
|
@ -8,14 +8,13 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.LieuZJ">
|
||||
<children>
|
||||
<SplitPane dividerPositions="0.6212121212121212" styleClass="background" stylesheets="@style/plateau.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<VBox alignment="CENTER" spacing="30.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label styleClass="text" text="Vous arrivez sur cette Carte Lieu" textOverrun="CLIP" wrapText="true">
|
||||
<font>
|
||||
|
37
src/ihm/ressources/RecevoirCarte.fxml
Normal file
37
src/ihm/ressources/RecevoirCarte.fxml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ihm.controller.RecevoirCarte">
|
||||
<children>
|
||||
<SplitPane dividerPositions="0.6212121212121212" styleClass="background" stylesheets="@style/plateau.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<VBox alignment="CENTER" spacing="30.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<Label fx:id="label" styleClass="text" text="Vous arrivez sur cette Carte Lieu" textOverrun="CLIP" wrapText="true">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Button fx:id="okButton" mnemonicParsing="false" styleClass="bouton" text="Ok" />
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<ImageView fx:id="imageView" fitHeight="158.0" fitWidth="132.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@ -10,6 +10,8 @@ import java.util.concurrent.FutureTask;
|
||||
|
||||
import carte.CarteEquipement;
|
||||
import carte.CarteLieu;
|
||||
import carte.CartePiochable;
|
||||
import carte.CartePiochable.Type;
|
||||
import database.RessourceLoader;
|
||||
import effet.Effet;
|
||||
import ihm.controller.PlateauController;
|
||||
@ -276,5 +278,20 @@ public class GestionnaireJeu {
|
||||
});
|
||||
}
|
||||
|
||||
public void piocher(Joueur j, CartePiochable cartePiochable) {
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
if(cartePiochable.getType() == Type.VISION) {
|
||||
pc.afficherVision(j, cartePiochable);
|
||||
}else {
|
||||
pc.afficherLT(j, cartePiochable);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
waitPlateau();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ public class Pioche {
|
||||
melanger();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void melanger()
|
||||
{
|
||||
Collections.shuffle(cartesPiochables);
|
||||
@ -28,8 +26,6 @@ public class Pioche {
|
||||
return cartesPiochables.pop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Stack<CartePiochable> getStack() {
|
||||
return cartesPiochables;
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
package main;
|
||||
|
||||
public interface Type {
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package main;
|
||||
|
||||
public class TypeLumiere implements Type {
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package main;
|
||||
|
||||
public class TypeTenebre implements Type{
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package main;
|
||||
|
||||
public class TypeVision implements Type {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user