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
@@ -1,18 +1,31 @@
package it.polimi.ingsw.gc14.View.TUI;
import it.polimi.ingsw.gc14.Model.Game;
import it.polimi.ingsw.gc14.Network.Observer;
import it.polimi.ingsw.gc14.View.IView;
public class TUI implements IView {
public class TUI implements IView, Observer {
// ── dati di stato ───────────────────────────────────────────
private BorderStyle style = BorderStyle.UNICODE;
private Game model;
private String username;
public TUI(Game model) {
this.model = model;
this.username="";
}
public void setUsername(String username) {
this.username = username;
}
@Override
public void update(Game model) {
this.model = model;
}
// ── punto di ingresso ───────────────────────────────────────
public void render(Game model)
public void render()
{
this.model=model;
try{
String os = System.getProperty("os.name").toLowerCase();
ProcessBuilder pb;
@@ -28,7 +41,7 @@ public class TUI implements IView {
System.out.println(model.toString());
}
public void renderBoard(Game model)
public void renderBoard()
{
try{
String os = System.getProperty("os.name").toLowerCase();
@@ -44,7 +57,7 @@ public class TUI implements IView {
}
System.out.println(model.BoardStamp());
}
public void renderPlayer(Game model)
public void renderPlayer()
{
try{
String os = System.getProperty("os.name").toLowerCase();
@@ -60,7 +73,7 @@ public class TUI implements IView {
}
System.out.println(model.BoardStamp());
}
public void renderMyHand(Game model,String username)
public void renderMyHand()
{
try{
String os = System.getProperty("os.name").toLowerCase();
@@ -76,6 +89,7 @@ public class TUI implements IView {
}
System.out.println(model.getPlayerByUsername(username));
}
public void showMessage(String message)
{