Almost work but the link to the difficulty doens't work everytime idk why
This commit is contained in:
parent
8c065e19f5
commit
bde347d84c
@ -8,7 +8,9 @@ import javafx.scene.layout.StackPane;
|
|||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import school_project.Controller;
|
import school_project.Controller;
|
||||||
|
import school_project.GameUI;
|
||||||
import school_project.MapGenerator;
|
import school_project.MapGenerator;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
public class MenuAccueil extends StackPane {
|
public class MenuAccueil extends StackPane {
|
||||||
|
|
||||||
@ -26,16 +28,36 @@ public class MenuAccueil extends StackPane {
|
|||||||
System.out.println(choosediff);
|
System.out.println(choosediff);
|
||||||
switch (choosediff) {
|
switch (choosediff) {
|
||||||
case "Easy":
|
case "Easy":
|
||||||
SlctDifficulty.setOnAction(event1 -> MapGenerator.generate(MapGenerator.Difficulty.Easy));
|
SlctDifficulty.setOnAction(event1 -> {
|
||||||
|
try {
|
||||||
|
Controller.switchRoot(new GameUI(MapGenerator.generate(MapGenerator.Difficulty.Easy)));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "Medium":
|
case "Medium":
|
||||||
SlctDifficulty.setOnAction(event1 -> MapGenerator.generate(MapGenerator.Difficulty.Medium));
|
SlctDifficulty.setOnAction(event1 -> {
|
||||||
|
try {
|
||||||
|
Controller.switchRoot(new GameUI(MapGenerator.generate(MapGenerator.Difficulty.Medium)));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "Difficult":
|
case "Difficult":
|
||||||
SlctDifficulty.setOnAction(event1 -> MapGenerator.generate(MapGenerator.Difficulty.Difficult));
|
SlctDifficulty.setOnAction(event1 -> {
|
||||||
break;
|
try {
|
||||||
}});
|
Controller.switchRoot(new GameUI(MapGenerator.generate(MapGenerator.Difficulty.Difficult)));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//set up all the Button where I need
|
//set up all the Button where I need
|
||||||
getChildren().addAll(Title,SlctDifficulty,SelectLevel,RdmLvl);
|
getChildren().addAll(Title,SlctDifficulty,SelectLevel,RdmLvl);
|
||||||
|
Loading…
Reference in New Issue
Block a user