Fixed Menu

This commit is contained in:
Bokros Bálint 2016-04-26 00:34:46 +02:00
parent 7c7c1ce9f9
commit 9436508c60

View File

@ -1,6 +1,8 @@
package cicaprojekt; package cicaprojekt;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
public class Menu { public class Menu {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
@ -9,33 +11,40 @@ public class Menu {
Tester tester = new Tester(); Tester tester = new Tester();
String in = System.console().readLine(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] input = in.split(" ");
switch (input[0]) { boolean isExiting = false;
case "loadMap" : while(!isExiting) {
tester.loadMap(input[1]); String[] input = br.readLine().split(" ");
break; switch (input[0]) {
case "listPlayers" : case "loadMap":
tester.listPlayers(); tester.loadMap(input[1]);
break; break;
case "move" : case "listPlayers":
tester.move(input[1]); tester.listPlayers();
break; break;
case "boxLift" : case "move":
tester.boxLift(input[1]); tester.move(input[1]);
break; break;
case "boxDrop" : case "boxLift":
tester.boxDrop(input[1]); tester.boxLift(input[1]);
break; break;
case "shootONeillsGun" : case "boxDrop":
tester.shootONeillsGun(input[1]); tester.boxDrop(input[1]);
break; break;
case "rotate" : case "shootONeillsGun":
tester.rotate(input[1], input[2]); tester.shootONeillsGun(input[1]);
break; break;
case "listStargates" : case "rotate":
tester.listStargates(); tester.rotate(input[1], input[2]);
break; break;
case "listStargates":
tester.listStargates();
break;
case "exit":
isExiting = true;
break;
}
} }