Timer Pt1
This commit is contained in:
parent
ddb35ae92d
commit
0af27d0aa7
|
|
@ -162,6 +162,7 @@ public class MyInterface extends JFrame {
|
||||||
public void clicButtonStart() {
|
public void clicButtonStart() {
|
||||||
this.instantiateSimu();
|
this.instantiateSimu();
|
||||||
int depth = askDifficulty();
|
int depth = askDifficulty();
|
||||||
|
int time=askTime();
|
||||||
game.setAutoPlayerDepth(depth);
|
game.setAutoPlayerDepth(depth);
|
||||||
game.setDefaultSetup();
|
game.setDefaultSetup();
|
||||||
}
|
}
|
||||||
|
|
@ -301,4 +302,25 @@ public class MyInterface extends JFrame {
|
||||||
default: return 2; // fallback to Medium
|
default: return 2; // 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