Semesterprojekt3019210/Interface.java

91 lines
2.1 KiB
Java

import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class Interface {
public static void main(String[] arg) throws FileNotFoundException {
menue();
}
public static void menue() throws FileNotFoundException {
welcomescreen();
boolean menue = true;
Scanner scan = new Scanner(System.in);
do {
String input = scan.nextLine();
if (input.equalsIgnoreCase("Starten")) {
Format.pad(141);
WortSpiel.spiel();
menue = false;
}else if(input.equalsIgnoreCase("Regeln")){
regeln();
}else if(input.equalsIgnoreCase("Spieler")) {
Format.pad(141);
WortSpiel.spieleroptionen();
welcomescreen();
}else if(input.equalsIgnoreCase("Ergebnis")) {
Format.pad(141);
WortSpiel.ergebnis();
}else if(input.equalsIgnoreCase("Back")) {
welcomescreen();
}else if(input.equalsIgnoreCase("Stop")) {
menue = false;
}else {
Format.pad(141);
System.out.println(Format.midpadword("Befehl war unzulässig!",140));
Format.pad(141);
welcomescreen();
}
}while(menue);
scan.close();
}
private static void regeln() throws FileNotFoundException {
Format.pad(141);
System.out.println(">->->->->->->->Regeln für das Wortketten-Spiel<-<-<-<-<-<-<-<");
Scanner scan = new Scanner(new File("src/Regeln.txt"));
while(scan.hasNext()) {
System.out.println(Format.padword(scan.nextLine(), 140));
}
Format.pad(141);
scan.close();
}
private static void welcomescreen() {
Format.pad(141);
System.out.println(">->->->Willkommen beim Wörterspiel<-<-<-<");
System.out.println(Format.padword("Starten", 40));
System.out.println(Format.padword("Regeln", 40));
System.out.println(Format.padword("Spieler", 40));
System.out.println(Format.padword("Ergebnis", 40));
System.out.println(Format.padword("Stop", 40));
System.out.println(Format.padword("Back", 40));
System.out.println(">>Bitte geben Sie die gewünschte Aktion an<<");
Format.pad(141);
}
}