Fix: Tui adapted to new input case

This commit is contained in:
rubenpirreram
2026-05-01 17:40:36 +02:00
parent 50a3012cf1
commit 44388ee1e4
9 changed files with 56 additions and 58 deletions
@@ -9,13 +9,15 @@ import java.util.Scanner;
public class ClientLauncherTUI {
//TODO Javadoc
TUI view;
public void main() throws InterruptedException {
TUI view=new TUI(null);
view=new TUI(null);
ClientController controller = new ClientController(view);
Scanner scanner = new Scanner(System.in);
System.out.println("Selezionare nome utente: ");
String username = scanner.next();
view.setUsername(username);
System.out.println("Selezionare numero di giocatori desiderato: ");
int proposedNumPlayers = scanner.nextInt();
System.out.println("Selezionare RMI[0] o TCP[1]: ");
@@ -70,9 +72,10 @@ public class ClientLauncherTUI {
private void getInput(Scanner scanner, ClientController controller, String username) {
String action = scanner.next();
int pos=-1;
if(!action.equals("8")) {
if(!action.equals("8")&&!action.equals("A")&&!action.equals("B")&&!action.equals("C")&&!action.equals("D")) {
try
{
System.out.println("Insert the required position:");
pos = scanner.nextInt();
}
catch(Exception e)
@@ -89,6 +92,9 @@ public class ClientLauncherTUI {
case "6" -> controller.pickOptionalTribeCard(username, pos);
case "7" -> controller.pickOptionalBuildingCard(username, pos);
case "8" -> controller.noOptionalCard(username);
case "A" -> view.fullRender();
case "B" -> view.renderBoard();
case "C" -> view.renderPlayer();
}
return;