Module it.polimi.ingsw.am13
Class ViewGUIControllerRooms
java.lang.Object
it.polimi.ingsw.am13.client.view.gui.ViewGUIController
it.polimi.ingsw.am13.client.view.gui.ViewGUIControllerRooms
Controller of the 'Rooms' scene, where the rooms are listed and the user can create/join/reconnect to a room
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.ChoiceBox
<ColorToken> private javafx.scene.control.TextField
private javafx.scene.control.Spinner
<Integer> private javafx.scene.control.TableView
<RoomIF> Fields inherited from class it.polimi.ingsw.am13.client.view.gui.ViewGUIController
networkHandler, scene, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate javafx.scene.paint.Color
chooseColorByToken
(Token token) Create a color object, choosing the color according to the given tokenprivate String
createShownPlayerString
(RoomIF room, int col) Generates the string for the one of the 4 player columns for the rooms table.private void
errorAlert
(String message) private String
findFreeNickname
(List<RoomIF> rooms) void
Force closing the app.void
void
void
void
void
setGameState
(GameState state) Method that sets the gameStatevoid
setThisPlayer
(PlayerLobby player) Method that sets the playervoid
Shows a generic exception in the view (specific exception could be handled in different ways, also depending on the phase or the state of game)void
showPlayerDisconnected
(PlayerLobby player) It shows that a player disconnected from an ongoing game by calling the corresponding method onViewGUIController
.void
showPlayerReconnected
(PlayerLobby player) It shows that a player reconnected to an ongoing game by calling the corresponding method onViewGUIController
.void
void
Methods inherited from class it.polimi.ingsw.am13.client.view.gui.ViewGUIController
getScene, setNetworkHandler, setScene, setStage, switchToScene
-
Field Details
-
roomsTable
-
nicknameField
private javafx.scene.control.TextField nicknameField -
colorBox
-
roomId
-
roomStatus
-
roomP1
-
roomP2
-
roomP3
-
roomP4
-
roomNP
-
nPlayersSpinner
-
-
Constructor Details
-
ViewGUIControllerRooms
public ViewGUIControllerRooms()
-
-
Method Details
-
setThisPlayer
Description copied from class:ViewGUIController
Method that sets the player- Specified by:
setThisPlayer
in classViewGUIController
- Parameters:
player
- the player associated to thisViewGUIController
-
setGameState
Description copied from class:ViewGUIController
Method that sets the gameState- Specified by:
setGameState
in classViewGUIController
- Parameters:
state
- the representation of the state of the game
-
getSceneTitle
- Specified by:
getSceneTitle
in classViewGUIController
- Returns:
- the title of the scene
-
showException
Description copied from class:ViewGUIController
Shows a generic exception in the view (specific exception could be handled in different ways, also depending on the phase or the state of game)- Specified by:
showException
in classViewGUIController
- Parameters:
e
- Exception to be shown
-
showPlayerDisconnected
Description copied from class:ViewGUIController
It shows that a player disconnected from an ongoing game by calling the corresponding method onViewGUIController
.- Specified by:
showPlayerDisconnected
in classViewGUIController
- Parameters:
player
- Player who disconnected
-
showPlayerReconnected
Description copied from class:ViewGUIController
It shows that a player reconnected to an ongoing game by calling the corresponding method onViewGUIController
.- Specified by:
showPlayerReconnected
in classViewGUIController
- Parameters:
player
- Player who reconnected
-
forceCloseApp
public void forceCloseApp()Force closing the app. It should be used to end the app for anomalous reasons- Specified by:
forceCloseApp
in classViewGUIController
-
showStartupScreen
public void showStartupScreen() -
chooseColorByToken
Create a color object, choosing the color according to the given token- Parameters:
token
- Token used to choose the color- Returns:
- Color corresponding to the token
-
createShownPlayerString
Generates the string for the one of the 4 player columns for the rooms table. It shows the player's nickname and if they are disconnected- Parameters:
room
- Room of the considered rowcol
- Index of the column. Only 0, 1, 2, 3 is accepted- Returns:
- String for the player. "-" if the column exceeds the number of players
-
showRooms
-
findFreeNickname
-
onCreateRoomButtonClick
public void onCreateRoomButtonClick() -
onJoinRoomButtonClick
public void onJoinRoomButtonClick() -
onRefreshRoomButtonClick
public void onRefreshRoomButtonClick() -
onReconnectMatchButtonClick
public void onReconnectMatchButtonClick() -
errorAlert
-