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
Modifier and TypeFieldDescriptionprivate String
Used to contain lobby's admin's nicknameprivate boolean
Used to verify whether the Game has endedprivate boolean
Used to verify whether the Game has startedprivate boolean
Used to verify whether the client is connected to the Serverprivate boolean
Used to verify whether the client has entered a lobbyprivate boolean
Used to verify whether the client is logged to the Serverprivate Model
Used to contain the gameprivate String
Used to contain client's nickname -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Method to disconnect the view from lobby (when the game ends or is closed for any reason)void
getAdmin()
Get lobby's admin's nicknameboolean
Get whether the game has started or notgetModel()
Get current gameget Client's nicknameboolean
Get whether the client has connected to the Server or notboolean
Get whether the game has ended or notboolean
Get whether the client has connected to a lobby or notboolean
isLogged()
Get whether the client has logged to the Server or notprivate void
Support method responsible for printing the 3 characterCardsprivate void
Support method responsible for printing all players' PlayerBoardsprivate void
Support method responsible for printing all field's components (islands and clouds)void
Prints all gameBoard's element that the user is allowed to see (Islands, clouds, playerBoards and characterCards)void
Set Game's admin's nicknamevoid
setConnected
(boolean connected) Set Client's connection status(connected or not)void
Set game's modelvoid
setGameEnded
(boolean gameEnded) Set Game's status (ended or not)void
setGameStarted
(boolean started) Set Game's status (started or not)void
setIsInLobby
(boolean inLobby) Set Client's status inside a lobby (connected to a lobby or not)void
setLogged
(boolean logged) Set Client's logged status inside the server (logged or not)void
setNickname
(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
-