Merge branch 'main' into GUI-2.0
This commit is contained in:
@@ -90,20 +90,23 @@ public class TUI implements IView {
|
||||
*/
|
||||
@Override
|
||||
public void render() {
|
||||
if(model.currentState.getGameStage().equals(GameStages.TOTEM_CHOICE))
|
||||
if(model != null)
|
||||
{
|
||||
renderTotems();
|
||||
if(model.currentState.getGameStage().equals(GameStages.TOTEM_CHOICE))
|
||||
{
|
||||
renderTotems();
|
||||
}
|
||||
else if(model.currentState.getGameStage().equals(GameStages.ENDED))
|
||||
{
|
||||
//renderStanding
|
||||
renderBoard();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderBoard();
|
||||
}
|
||||
System.out.println("\nYOUR ACTION:");
|
||||
}
|
||||
else if(model.currentState.getGameStage().equals(GameStages.ENDED))
|
||||
{
|
||||
//renderStanding
|
||||
renderBoard();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderBoard();
|
||||
}
|
||||
System.out.println("\nYOUR ACTION:");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,14 +158,13 @@ public class TUI implements IView {
|
||||
public void renderTotems() {
|
||||
clearTerminal();
|
||||
var table = new AsciiTable(BorderStyle.ROUNDED, model.availableTotems.size());
|
||||
List<String> lines = model.availableTotems.stream().map(Totems::toString).toList();
|
||||
int i=0;
|
||||
for(String line : lines)
|
||||
List<String> lines =new ArrayList<>();
|
||||
for(int i=0;i<model.availableTotems.size();i++)
|
||||
{
|
||||
line = (i++) +". "+ line;
|
||||
lines.add(i+"."+model.availableTotems.get(i));
|
||||
}
|
||||
table.addRow(lines);
|
||||
System.out.println(model.currentState+"\nTOTEMS AVAILABLE:\n"+table.build());
|
||||
System.out.println(model.currentState+"\nTOTEMS AVAILABLE:\n"+table.build()+"\nPress 9 and then write the position");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +227,6 @@ public class TUI implements IView {
|
||||
table.addRow(List.of("6-PickOptionalBuilding(pos)", ""));
|
||||
table.addRow(List.of("7-NoOptional", ""));
|
||||
table.addRow(List.of("8-SkipTurn", ""));
|
||||
table.addRow(List.of("9-TotemChoice(pos)", ""));
|
||||
return table.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user