Merge branch 'main' of https://gitarero.ecam.fr/romain.murphy/OOP_2B1_Project.git into main
This commit is contained in:
commit
ddbc1cba4b
|
|
@ -162,6 +162,7 @@ public class MyInterface extends JFrame {
|
|||
public void clicButtonStart() {
|
||||
this.instantiateSimu();
|
||||
int depth = askDifficulty();
|
||||
int time=askTime();
|
||||
game.setAutoPlayerDepth(depth);
|
||||
game.setDefaultSetup();
|
||||
}
|
||||
|
|
@ -301,4 +302,25 @@ public class MyInterface extends JFrame {
|
|||
default: return 3; // fallback to Medium
|
||||
}
|
||||
}
|
||||
private int askTime() {
|
||||
Object[] options = {"1 min", "2 Min", "5 Min", "10 Min"};
|
||||
int choice = JOptionPane.showOptionDialog(
|
||||
this,
|
||||
"Select Difficulty Level:",
|
||||
"Difficulty",
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[3] // default: 10
|
||||
);
|
||||
|
||||
switch (choice) {
|
||||
case 0: return 1; // 1 min
|
||||
case 1: return 2; // 2 min
|
||||
case 2: return 3; // 5 min
|
||||
case 3: return 4;// 10 min
|
||||
default: return 4; // 10 min
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue