Correction du numéro du joueur + factorisation de quelques méthodes de window
This commit is contained in:
parent
db2e2e1f7a
commit
422b0a4962
@ -15,7 +15,9 @@ import javafx.scene.layout.Pane;
|
|||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.shape.Rectangle;
|
import javafx.scene.shape.Rectangle;
|
||||||
|
import javafx.scene.text.Font;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
|
import javafx.scene.text.TextAlignment;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class Window extends AbstractView {
|
public class Window extends AbstractView {
|
||||||
@ -64,18 +66,14 @@ public class Window extends AbstractView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
putStatePlayerPane(principalPane);
|
putStatePlayerPane(principalPane);
|
||||||
StackPane stateMoveTextPane = showMoveText();
|
putMoveTextPane(principalPane);
|
||||||
stateMoveTextPane.setLayoutY(480);
|
Button buttonNext = new Button("SUIVANT");
|
||||||
principalPane.getChildren().add(stateMoveTextPane);
|
buttonNext .setOnAction(new ClientEventHandler(new ButtonListener(game)));
|
||||||
|
buttonNext .setLayoutX(700);
|
||||||
|
buttonNext .setLayoutY(600);
|
||||||
Button followingButton = new Button("SUIVANT");
|
buttonNext .setStyle("-fx-background-color: #a96806;");
|
||||||
followingButton.setOnAction(new ClientEventHandler(new ButtonListener(game)));
|
buttonNext .setTextFill(javafx.scene.paint.Color.WHITE);
|
||||||
followingButton.setLayoutX(700);
|
principalPane.getChildren().add(buttonNext);
|
||||||
followingButton.setLayoutY(600);
|
|
||||||
followingButton.setStyle("-fx-background-color: #a96806;");
|
|
||||||
followingButton.setTextFill(javafx.scene.paint.Color.WHITE);
|
|
||||||
principalPane.getChildren().add(followingButton);
|
|
||||||
return principalPane;
|
return principalPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,12 +85,12 @@ public class Window extends AbstractView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 07/12/2021 WARNING : générer autant de frames qu’il y a de joueurs,(à implémenter)
|
// TODO: 07/12/2021 WARNING : générer autant de frames qu’il y a de joueurs,(à implémenter)
|
||||||
// TODO: 07/12/2021 Maintenant régler : Factorisation du code, Responsive
|
// TODO: 07/12/2021 Maintenant régler : Responsive
|
||||||
|
|
||||||
|
|
||||||
//à voir si on peut faire plus proprement les deux méthodes en dessous avec une List<StackPane> ?
|
|
||||||
public void putStatePlayerPane(Pane principalPane){
|
public void putStatePlayerPane(Pane principalPane){
|
||||||
int Y = 0;
|
int Y = 0;
|
||||||
for(int i=0;i < game.getPlayers().size();i++){
|
for(int i=0;i<game.getPlayers().size();i++){
|
||||||
StackPane sp = showStatePlayer(i);
|
StackPane sp = showStatePlayer(i);
|
||||||
sp.setLayoutX(480);
|
sp.setLayoutX(480);
|
||||||
sp.setLayoutY(Y);
|
sp.setLayoutY(Y);
|
||||||
@ -107,22 +105,27 @@ public class Window extends AbstractView {
|
|||||||
"Energie : " + game.getPlayers().get(playerNumber).getEnergy() + "\n" +
|
"Energie : " + game.getPlayers().get(playerNumber).getEnergy() + "\n" +
|
||||||
"Arme : " + game.getPlayers().get(playerNumber).getWeapon().getClass().getSimpleName() + "\n";
|
"Arme : " + game.getPlayers().get(playerNumber).getWeapon().getClass().getSimpleName() + "\n";
|
||||||
Text t = new Text(s);
|
Text t = new Text(s);
|
||||||
|
|
||||||
Rectangle r = new Rectangle();
|
Rectangle r = new Rectangle();
|
||||||
r.setWidth(500);
|
r.setWidth(500);
|
||||||
r.setHeight(90);
|
r.setHeight(90);
|
||||||
//à voir
|
|
||||||
if(game.getPlayers().get(playerNumber).getEnergy() <= 0){
|
if(game.getPlayers().get(playerNumber).getEnergy() <= 0){
|
||||||
r.setFill(Color.RED);
|
r.setFill(Color.RED);
|
||||||
}else{
|
}else{
|
||||||
r.setFill(Color.GREEN);
|
r.setFill(Color.GREEN);
|
||||||
}
|
}
|
||||||
r.setStrokeWidth(2);
|
r.setStrokeWidth(1);
|
||||||
r.setStroke(Color.BLACK);
|
r.setStroke(Color.BLACK);
|
||||||
subSp.getChildren().addAll(r,t);
|
subSp.getChildren().addAll(r,t);
|
||||||
return subSp;
|
return subSp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//idem que au dessus
|
public void putMoveTextPane(Pane principalPane){
|
||||||
|
StackPane stateMoveTextPane = showMoveText();
|
||||||
|
stateMoveTextPane.setLayoutY(480);
|
||||||
|
principalPane.getChildren().add((stateMoveTextPane));
|
||||||
|
}
|
||||||
|
|
||||||
public StackPane showMoveText(){
|
public StackPane showMoveText(){
|
||||||
StackPane subSp = new StackPane();
|
StackPane subSp = new StackPane();
|
||||||
String s = "Joueur : " + (player.getId()+1) + "\n" +
|
String s = "Joueur : " + (player.getId()+1) + "\n" +
|
||||||
@ -131,7 +134,7 @@ public class Window extends AbstractView {
|
|||||||
Rectangle r = new Rectangle();
|
Rectangle r = new Rectangle();
|
||||||
r.setWidth(478);
|
r.setWidth(478);
|
||||||
r.setHeight(165);
|
r.setHeight(165);
|
||||||
r.setStrokeWidth(2);
|
r.setStrokeWidth(1);
|
||||||
r.setStroke(Color.BLACK);
|
r.setStroke(Color.BLACK);
|
||||||
r.setFill(Color.WHITE);
|
r.setFill(Color.WHITE);
|
||||||
subSp.getChildren().addAll(r,t);
|
subSp.getChildren().addAll(r,t);
|
||||||
|
Loading…
Reference in New Issue
Block a user