Grisser les joueurs non ajoutés

This commit is contained in:
Yessine Ben El Bey 2020-04-20 14:39:19 +02:00
parent 0633478389
commit 1a59e9759a
7 changed files with 285 additions and 111 deletions

View File

@ -0,0 +1,50 @@
package condition;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import main.Joueur;
import carte.CartePersonnage;
import carte.Type;
public class ConditionClass<T> extends Condition{
private List<Class<T>> classes;
public ConditionClass(Class<T> ... classes){
// TODO
this.classes = new ArrayList<Class<T>>();
this.classes.addAll(Arrays.asList(classes));
}
/**
* Vérifie qu'il existe au moins une classe qui correspond soit au Type soit au Personnage du Joueur.
* <br><br>
* exemple :
*
* classes = { Emi.class, Metamorphe.class, ... etc } ou classes = { Hunter.class, Shadow.class, Neutre.class }
* <br>
* Si la class de la carte du joueur correspond à un des élements dans classes alors on renvoie vrai, même chose pour les types.
*
* @param joueur Le joueur sur lequel on vérifie les conditions.
* @return boolean
*/
@Override
public boolean isTrue(Joueur joueur)
{
Class<? extends T> ccp = (Class<? extends T>) joueur.getCartePersonnage().getClass();
Class<? extends T> cct = (Class<? extends T>) joueur.getType().getClass();
for(Class<? extends T> classe : classes) {
if(ccp.getClass() == classe.getClass() || cct.getClass() == classe.getClass() ) return true;
}
return false;
}
}

View File

@ -0,0 +1,9 @@
package effet;
import main.Joueur;
public abstract class EffetTarget extends Effet{
public abstract void utiliser(Joueur joueur);
}

View File

@ -15,11 +15,12 @@ import javafx.scene.layout.Pane;
public class PlayersController implements Initializable{ public class PlayersController implements Initializable{
@FXML @FXML
private BorderPane rootPane; private BorderPane rootPane;
@FXML
private TextField tf;
@Override @Override
public void initialize(URL arg0, ResourceBundle arg1) { public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub tf.setEditable(false);
} }
@FXML @FXML
@ -28,4 +29,9 @@ public class PlayersController implements Initializable{
BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Plateau.fxml")); BorderPane pane = FXMLLoader.load(getClass().getResource("../ressources/Plateau.fxml"));
rootPane.getChildren().setAll(pane); rootPane.getChildren().setAll(pane);
} }
@FXML
public void ajoutJoueur(MouseEvent mouseEvent) throws IOException{
tf.setEditable(true);
}
} }

View File

@ -42,117 +42,117 @@
</top> </top>
<left> <left>
<HBox alignment="CENTER_LEFT" prefHeight="533.0" prefWidth="520.0" BorderPane.alignment="CENTER"> <HBox alignment="CENTER_LEFT" prefHeight="533.0" prefWidth="520.0" BorderPane.alignment="CENTER">
<children>
<VBox alignment="CENTER_LEFT" prefHeight="533.0" prefWidth="1142.0">
<children>
<TextField fx:id="tfJ1">
<font>
<Font size="24.0" />
</font></TextField>
<TextField>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font></TextField>
<TextField>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font></TextField>
<TextField>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font></TextField>
</children>
</VBox>
<VBox prefHeight="533.0" prefWidth="18.0">
<children>
<VBox alignment="CENTER" prefHeight="533.0" prefWidth="258.0">
<children>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets left="10.0" top="5.0" />
</VBox.margin></Button>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<VBox.margin>
<Insets left="10.0" top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font></Button>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<VBox.margin>
<Insets left="10.0" top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font></Button>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<VBox.margin>
<Insets left="10.0" top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font></Button>
</children>
</VBox>
</children>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</VBox>
<VBox alignment="CENTER_LEFT" prefHeight="533.0" prefWidth="76.0">
<children>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<padding>
<Insets top="5.0" />
</padding>
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets left="10.0" />
</VBox.margin></CheckBox>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets left="10.0" top="30.0" />
</VBox.margin></CheckBox>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets left="10.0" top="30.0" />
</VBox.margin></CheckBox>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<font>
<Font size="24.0" />
</font>
<VBox.margin>
<Insets left="10.0" top="30.0" />
</VBox.margin></CheckBox>
</children>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</VBox>
</children>
<BorderPane.margin> <BorderPane.margin>
<Insets left="20.0" /> <Insets left="20.0" />
</BorderPane.margin> </BorderPane.margin>
<children>
<HBox prefHeight="533.0" prefWidth="697.0">
<children>
<VBox alignment="CENTER" prefHeight="525.0" prefWidth="342.0">
<children>
<TextField fx:id="tf" prefWidth="230.0">
<font>
<Font size="24.0" />
</font>
</TextField>
<TextField>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</TextField>
<TextField>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</TextField>
<TextField>
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</TextField>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
<children>
<Button mnemonicParsing="false" onMouseClicked="#ajoutJoueur" prefHeight="42.0" prefWidth="53.0" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<font>
<Font size="24.0" />
</font>
</Button>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</Button>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</Button>
<Button mnemonicParsing="false" styleClass="bouton" stylesheets="@style/menu.css" text="+">
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</Button>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="530.0" prefWidth="68.0">
<children>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</CheckBox>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</CheckBox>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</CheckBox>
<CheckBox mnemonicParsing="false" stylesheets="@style/menu.css">
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
<font>
<Font size="24.0" />
</font>
</CheckBox>
</children>
</VBox>
</children>
</HBox>
</children>
</HBox> </HBox>
</left> </left>
<right> <right>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox layoutX="11.0" layoutY="14.0" prefHeight="60.0" prefWidth="345.0" spacing="30.0">
<children>
<HBox prefHeight="29.0" prefWidth="55.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox prefHeight="29.0" prefWidth="55.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox prefHeight="54.0" prefWidth="107.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox prefHeight="29.0" prefWidth="55.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
</children>
</HBox>
<HBox layoutX="14.0" layoutY="317.0" prefHeight="60.0" prefWidth="345.0" spacing="30.0">
<children>
<HBox prefHeight="29.0" prefWidth="55.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox prefHeight="29.0" prefWidth="55.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox prefHeight="54.0" prefWidth="107.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
<HBox prefHeight="29.0" prefWidth="55.0">
<children>
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fitHeight="60.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
</children>
</HBox>
<Label layoutX="114.0" layoutY="183.0" text="Choississez une équipement à voler">
<font>
<Font size="24.0" />
</font>
</Label>
</children>
</Pane>

5
src/main/Effet.java Normal file
View File

@ -0,0 +1,5 @@
package main;
public class Effet {
}

View File

@ -0,0 +1,14 @@
package condition;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class ConditionClassTest {
@Test
void test() {
fail("Not yet implemented");
}
}