Package it.polimi.ingsw.Client.CLI
Class ClientView
java.lang.Object
it.polimi.ingsw.Client.CLI.ClientView
This class contains the status of Client inside the Server and is responsible for printing UI elements in to the CLI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringUsed to contain lobby's admin's nicknameprivate booleanUsed to verify whether the Game has endedprivate booleanUsed to verify whether the Game has startedprivate booleanUsed to verify whether the client is connected to the Serverprivate booleanUsed to verify whether the client has entered a lobbyprivate booleanUsed to verify whether the client is logged to the Serverprivate ModelUsed to contain the gameprivate StringUsed to contain client's nickname -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMethod to disconnect the view from lobby (when the game ends or is closed for any reason)voidgetAdmin()Get lobby's admin's nicknamebooleanGet whether the game has started or notgetModel()Get current gameget Client's nicknamebooleanGet whether the client has connected to the Server or notbooleanGet whether the game has ended or notbooleanGet whether the client has connected to a lobby or notbooleanisLogged()Get whether the client has logged to the Server or notprivate voidSupport method responsible for printing the 3 characterCardsprivate voidSupport method responsible for printing all players' PlayerBoardsprivate voidSupport method responsible for printing all field's components (islands and clouds)voidPrints all gameBoard's element that the user is allowed to see (Islands, clouds, playerBoards and characterCards)voidSet Game's admin's nicknamevoidsetConnected(boolean connected) Set Client's connection status(connected or not)voidSet game's modelvoidsetGameEnded(boolean gameEnded) Set Game's status (ended or not)voidsetGameStarted(boolean started) Set Game's status (started or not)voidsetIsInLobby(boolean inLobby) Set Client's status inside a lobby (connected to a lobby or not)voidsetLogged(boolean logged) Set Client's logged status inside the server (logged or not)voidsetNickname(String nickname) Set Client's nickname
-
Field Details
-
model
Used to contain the game -
isConnected
private boolean isConnectedUsed to verify whether the client is connected to the Server -
isLogged
private boolean isLoggedUsed to verify whether the client is logged to the Server -
isInLobby
private boolean isInLobbyUsed to verify whether the client has entered a lobby -
gameStarted
private boolean gameStartedUsed to verify whether the Game has started -
gameEnded
private boolean gameEndedUsed to verify whether the Game has ended -
admin
Used to contain lobby's admin's nickname -
Nickname
Used to contain client's nickname
-
-
Constructor Details
-
ClientView
public ClientView()
-
-
Method Details
-
getAdmin
Get lobby's admin's nickname- Returns:
- admin's nickname
-
setAdmin
Set Game's admin's nickname- Parameters:
admin- String containing admin's nickname
-
getModel
Get current game- Returns:
- gameBoard representing the game
-
getGameStarted
public boolean getGameStarted()Get whether the game has started or not- Returns:
- true if the game has started, false otherwise
-
setGameStarted
public void setGameStarted(boolean started) Set Game's status (started or not)- Parameters:
started- boolean representing whether the game has started or not
-
isGameEnded
public boolean isGameEnded()Get whether the game has ended or not- Returns:
- true if the game has ended, false otherwise
-
setGameEnded
public void setGameEnded(boolean gameEnded) Set Game's status (ended or not)- Parameters:
gameEnded- boolean representing whether the game has ended or not
-
isInLobby
public boolean isInLobby()Get whether the client has connected to a lobby or not- Returns:
- true if the client has connected to a lobby, false otherwise
-
isConnected
public boolean isConnected()Get whether the client has connected to the Server or not- Returns:
- true if the client has connected to the Server, false otherwise
-
setConnected
public void setConnected(boolean connected) Set Client's connection status(connected or not)- Parameters:
connected- boolean representing whether the client has connected or not to the server
-
isLogged
public boolean isLogged()Get whether the client has logged to the Server or not- Returns:
- true if the client has logged to the Server, false otherwise
-
setLogged
public void setLogged(boolean logged) Set Client's logged status inside the server (logged or not)- Parameters:
logged- boolean representing whether the client is logged or not
-
printView
public void printView()Prints all gameBoard's element that the user is allowed to see (Islands, clouds, playerBoards and characterCards) -
printIslandField
private void printIslandField()Support method responsible for printing all field's components (islands and clouds) -
printGameBoards
private void printGameBoards()Support method responsible for printing all players' PlayerBoards -
printCharacterCard
private void printCharacterCard()Support method responsible for printing the 3 characterCards -
getNickname
get Client's nickname- Returns:
- String containing the nickname
-
setNickname
Set Client's nickname- Parameters:
nickname- String containing Client's nickname
-
disconnectViewFromServer
public void disconnectViewFromServer() -
disconnectView
public void disconnectView()Method to disconnect the view from lobby (when the game ends or is closed for any reason) -
setIsInLobby
public void setIsInLobby(boolean inLobby) Set Client's status inside a lobby (connected to a lobby or not)- Parameters:
inLobby- boolean representing whether the client is in lobby or not
-
setGame
Set game's model- Parameters:
game- GameBoard containing game's model
-