Merge remote-tracking branch 'origin/main'

This commit is contained in:
Speedy Gonzalez 2021-12-02 15:28:20 +01:00
commit c8d560b8c9
4 changed files with 42 additions and 20 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View File

@ -8,9 +8,6 @@ public enum Command {
private String commandWord; private String commandWord;
public static <T extends Enum<T>> T getEnumValue(TextIO textIO, Class<T> commands) {
return textIO.newEnumInputReader(commands).read("What would you like to do?");
}
Command(String commandWord) { Command(String commandWord) {

View File

@ -3,34 +3,57 @@ import org.beryx.textio.TextIO;
import org.beryx.textio.TextIoFactory; import org.beryx.textio.TextIoFactory;
import org.beryx.textio.TextTerminal; import org.beryx.textio.TextTerminal;
import java.awt.*;
import java.util.HashMap;
import static ch.zhaw.catan.Command.QUIT;
import static ch.zhaw.catan.Command.UNKNOWN;
public class Parser { public class Parser {
TextIO textIO = TextIoFactory.getTextIO(); TextIO textIO = TextIoFactory.getTextIO();
TextTerminal<?> textTerminal; TextTerminal<?> textTerminal;
public Parser() { public Parser() {
textTerminal = textIO.getTextTerminal(); textTerminal = textIO.getTextTerminal();
run(); }
public Point getPoint() {
return null;
} }
public void run() { public HashMap<String, Integer> gameStart(){
boolean running = true; return null;
while (running) { //Anzahlspieler,int
switch(Command.getEnumValue(textIO, Command.class)){ //Siegespunkte,int
}
public void giveCoordinatesForStructures(Config.Structure structure) {
}
public void thrownDices(int number){
}
public void playerTurn(Config.Faction faction) {
}
public void errorMessage(){
}
public Command getAction() {
switch (textIO.newEnumInputReader(Command.class).read("What would you like to do?")) {
case QUIT: case QUIT:
running = false; System.out.println("quit");
break; return QUIT;
case UNKNOWN: case UNKNOWN:
break; return UNKNOWN;
default:
return null;
}
} }
} }
} }

View File

@ -15,6 +15,8 @@ public class Siedler {
TextIO textIO = TextIoFactory.getTextIO(); TextIO textIO = TextIoFactory.getTextIO();
TextTerminal<?> textTerminal = textIO.getTextTerminal(); TextTerminal<?> textTerminal = textIO.getTextTerminal();
textTerminal.println(game.getBoard().getTextView()); textTerminal.println(game.getBoard().getTextView());
Parser parser = new Parser();
parser.getAction();