Update: TUI totem choice impl
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.View.TUI;
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Slot;
|
||||
import it.polimi.ingsw.gc14.Model.*;
|
||||
import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -92,7 +90,20 @@ public class TUI implements IView {
|
||||
*/
|
||||
@Override
|
||||
public void render() {
|
||||
renderBoard();
|
||||
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:");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,10 +152,23 @@ public class TUI implements IView {
|
||||
System.out.println(AsciiTable.sideBySide(lines, lines2, 3));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
line = (i++) +". "+ line;
|
||||
}
|
||||
table.addRow(lines);
|
||||
System.out.println(model.currentState+"\nTOTEMS AVAILABLE:\n"+table.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the player status table only.
|
||||
*
|
||||
* <p>Layout:
|
||||
* <p>Layout:SkipTurn
|
||||
* <ul>
|
||||
* <li><b>Left panel</b> — prestige, food, character deck, and building
|
||||
* deck for all players, as produced by {@link #PlayersStamp()}.</li>
|
||||
@@ -201,6 +225,7 @@ 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