Add: ClientLauncherTUI. Connection and model sending works.
Note: ClientController.view is commented out since class TUI is still missing
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package it.polimi.ingsw.gc14;
|
||||
import it.polimi.ingsw.gc14.Controller.ClientController;
|
||||
import it.polimi.ingsw.gc14.Network.RMI.Client.RMIClient;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ClientLauncherTUI {
|
||||
public void main() throws InterruptedException {
|
||||
ClientController controller = new ClientController();
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
System.out.println("Selezionare nome utente: ");
|
||||
String username = scanner.next();
|
||||
System.out.println(username);
|
||||
|
||||
System.out.println("Selezionare numero di giocatori desiderato: ");
|
||||
int proposedNumPlayers = scanner.nextInt();
|
||||
System.out.println(proposedNumPlayers);
|
||||
|
||||
System.out.println("Selezionare RMI[0] o TCP[1]: ");
|
||||
int networkType = scanner.nextInt();
|
||||
System.out.println(networkType);
|
||||
|
||||
scanner.close();
|
||||
|
||||
if (networkType == 0) {
|
||||
RMIClient client = new RMIClient("localhost", 1099);
|
||||
if (client.connect(username, proposedNumPlayers, controller)) {
|
||||
System.out.println("CLIENT CONNESSO DAJE");
|
||||
} else {
|
||||
System.out.println("NON CONNESSO D:");
|
||||
}
|
||||
|
||||
while(true) {
|
||||
System.out.flush();
|
||||
if (controller.localModel!=null) {
|
||||
System.out.println("MODEL SETTATO");
|
||||
}
|
||||
Thread.sleep(500);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else if (networkType == 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user