retry_level #73
@ -77,7 +77,7 @@ public class GameUI extends Group{
|
||||
_piece.setLayoutY(grid.getLayoutY() + p.getPosition().x * (SEGMENT_SIZE+SPACE_SIZE));
|
||||
}
|
||||
if(level.gameDone()){
|
||||
Controller.switchRoot(new ScreenLevelFinish());
|
||||
Controller.switchRoot(new ScreenLevelFinish(level));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -9,11 +9,15 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Font;
|
||||
import school_project.Controller;
|
||||
import school_project.GameUI;
|
||||
import school_project.Map;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class ScreenLevelFinish extends StackPane {
|
||||
|
||||
public ScreenLevelFinish(){
|
||||
public ScreenLevelFinish(Map lastlevel){
|
||||
super();
|
||||
Button retry = new Button("Retry Level");
|
||||
Label CongraMess = new Label(" LEVEL DONE GREAT JOB ");
|
||||
CongraMess.setFont(Font.font(40));
|
||||
Button BckMenu = new Button("Back to Menu");
|
||||
@ -23,14 +27,23 @@ public class ScreenLevelFinish extends StackPane {
|
||||
|
||||
BckMenu.setOnAction(event -> Controller.switchRoot(new MenuAccueil()));
|
||||
ChooseLvl.setOnAction(event -> Controller.switchRoot(new MenuLevel(1)));
|
||||
retry.setOnAction(event -> {
|
||||
try {
|
||||
Controller.switchRoot(new GameUI(lastlevel));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
getChildren().addAll(BckMenu,ChooseLvl,CongraMess);
|
||||
getChildren().addAll(BckMenu,ChooseLvl,CongraMess,retry);
|
||||
setAlignment(retry,Pos.BOTTOM_CENTER);
|
||||
setAlignment(BckMenu, Pos.CENTER_RIGHT);
|
||||
setAlignment(ChooseLvl, Pos.CENTER_LEFT);
|
||||
setAlignment(CongraMess, Pos.TOP_CENTER);
|
||||
setMargin(BckMenu, new Insets(0,300,0,0 ));
|
||||
setMargin(ChooseLvl,new Insets(0,0,0,300));
|
||||
setMargin(CongraMess,new Insets(300,0,0,0));
|
||||
setMargin(retry,new Insets(0,0,300,0));
|
||||
|
||||
getStyleClass().add("StackPane");
|
||||
getStylesheets().add(String.valueOf(getClass().getResource("StyleMenuAcceuil.css")));
|
||||
|
Loading…
Reference in New Issue
Block a user