Class CommunicationController
java.lang.Object
it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
it.polimi.ingsw.server.controller.game_state_controller.CommunicationController
- Direct Known Subclasses:
ExpertCommunicationController
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommunicationController(List<Player> players, boolean isExpertMode) CommunicationController(List<org.javatuples.Pair<String, Integer>> players, UUID gameUUID) -
Method Summary
Modifier and TypeMethodDescriptionvoidbase(SugarMessage message, Peer peer) static CommunicationControllercreateCommunicationController(List<Player> players, boolean isExpertMode) static CommunicationControllercreateCommunicationController(List<org.javatuples.Pair<String, Integer>> players, boolean isExpertMode, UUID gameUUID) endTurnMsg(EndTurnMsg message, Peer peer) This method is the handler for the EndTurnMsgReturn light game state from the communication controllerprivate intgetSchoolBoardIdFromUsername(String player) getTeamUsernames(String username) Returns the usernames in my teamprivate StringgetUsernameFromSchoolBoardId(int schoolBoardId) getUsernameToWinnerMap(Map<Integer, Boolean> schoolBoardIdToWinnerMap) grabStudentsFromCloudMsg(GrabStudentsFromCloudMsg message, Peer peer) This method is the handler for the GrabStudentsFromCloudMsgprotected GameStateControllerinitializeGameStateController(int playersNumber) protected GameStateControllerinitializeGameStateController(UUID gameUUID) (package private) booleanisOthersPlayersTurn(String player) This method whether a move was sent by the current player or not.moveMotherNatureMsg(MoveMotherNatureMsg message, Peer peer) This method is the handler for the MoveMotherNatureMsgThis method is the handler for the MoveStudentFromEntranceToArchipelagoMsgThis method is the handler fot the MoveStudentFromEntranceToDiningRoomMsgplayCardMsg(PlayCardMsg message, Peer peer) This method is the handler for the PlayCardMsgrollbackMsg(RollbackMsg message, Peer peer) This method is the handler for the RollBackMsgMethods inherited from class it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
drop, process, process, processFromLowerLayers
-
Field Details
-
gameStateController
-
usernameToSchoolBoardId
-
-
Constructor Details
-
CommunicationController
protected CommunicationController(List<Player> players, boolean isExpertMode) throws GameStateInitializationFailureException -
CommunicationController
-
-
Method Details
-
initializeGameStateController
protected GameStateController initializeGameStateController(int playersNumber) throws GameStateInitializationFailureException -
initializeGameStateController
-
createCommunicationController
public static CommunicationController createCommunicationController(List<Player> players, boolean isExpertMode) throws GameStateInitializationFailureException -
createCommunicationController
public static CommunicationController createCommunicationController(List<org.javatuples.Pair<String, Integer>> players, boolean isExpertMode, UUID gameUUID) -
isOthersPlayersTurn
This method whether a move was sent by the current player or not.- Parameters:
player- indicates a peer, therefore a player,- Returns:
- true if the move has to be processed, because it is performed by the current player, false otherwise.
-
rollbackMsg
This method is the handler for the RollBackMsg- Parameters:
message- is the RollBackMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
playCardMsg
This method is the handler for the PlayCardMsg- Parameters:
message- is the PlayCardMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
moveStudentFromEntranceToDiningRoomMsg
public SugarMessage moveStudentFromEntranceToDiningRoomMsg(MoveStudentFromEntranceToDiningRoomMsg message, Peer peer) This method is the handler fot the MoveStudentFromEntranceToDiningRoomMsg- Parameters:
message- is the MoveStudentFromEntranceToDiningRoomMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
moveStudentFromEntranceToArchipelagoMsg
public SugarMessage moveStudentFromEntranceToArchipelagoMsg(MoveStudentFromEntranceToArchipelagoMsg message, Peer peer) This method is the handler for the MoveStudentFromEntranceToArchipelagoMsg- Parameters:
message- is the MoveStudentFromEntranceToArchipelagoMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
moveMotherNatureMsg
This method is the handler for the MoveMotherNatureMsg- Parameters:
message- is the MoveMotherNatureMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
grabStudentsFromCloudMsg
This method is the handler for the GrabStudentsFromCloudMsg- Parameters:
message- is the GrabStudentsFromCloudMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
endTurnMsg
This method is the handler for the EndTurnMsg- Parameters:
message- is the EndTurnMsgpeer- is the Peer from which the message is received- Returns:
- a SugarMessage with the response of the invocation
-
getTeamUsernames
Returns the usernames in my team- Parameters:
username- of the player- Returns:
- a List
that contains all the users in my team, in 2/3 players games, it returns a list containing only the given username
-
getLightGameState
Return light game state from the communication controller- Returns:
- light game state
-
getUsernameToWinnerMap
-
getGameUUID
-
getSchoolBoardIdFromUsername
-
getUsernameFromSchoolBoardId
-
base
-