Bind: TUI->Launcher

This commit is contained in:
rubenpirreram
2026-04-30 18:01:35 +02:00
parent 239b6687fb
commit 7e3623d3ae
5 changed files with 34 additions and 24 deletions
@@ -3,12 +3,15 @@ import it.polimi.ingsw.gc14.Controller.ClientController;
import it.polimi.ingsw.gc14.Network.RMI.Client.RMIClient;
import it.polimi.ingsw.gc14.Network.TCP.Client.TCPClient;
import it.polimi.ingsw.gc14.View.IView;
import it.polimi.ingsw.gc14.View.TUI.TUI;
import java.util.Scanner;
public class ClientLauncherTUI {
private IView view;
public void main() throws InterruptedException {
ClientController controller = new ClientController();
view=new TUI(null);
ClientController controller = new ClientController(view);
Scanner scanner = new Scanner(System.in);
@@ -29,11 +32,12 @@ public class ClientLauncherTUI {
System.out.println("Succesfully connected to RMI server\n\n");
} else {
System.out.println("RMI connection refused\n\n");
return;
}
while(true) {
System.out.flush();
if (controller.localModel!=null) {
if (controller.localController.getModel()!=null) {
break;
}
Thread.sleep(500);
@@ -43,7 +47,7 @@ public class ClientLauncherTUI {
System.out.print("\033[H\033[2J");
System.out.flush();
System.out.println(controller.localModel);
System.out.println(controller.localController.getModel());
} else if (networkType == 1) {
@@ -56,7 +60,7 @@ public class ClientLauncherTUI {
while(true) {
System.out.flush();
if (controller.localModel!=null) {
if (controller.localController.getModel()!=null) {
break;
}
Thread.sleep(500);
@@ -66,7 +70,7 @@ public class ClientLauncherTUI {
System.out.print("\033[H\033[2J");
System.out.flush();
System.out.println(controller.localModel);
System.out.println(controller.localController.getModel());
}
}
}