Interface IGameServer
- All Superinterfaces:
Remote
- All Known Implementing Classes:
RMIServer
Remote interface used by RMI clients to interact with the game server.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddisconnectPlayer(String username) Notifies the server of a voluntary disconnection for the specified player.voiddrawLowerBuildingCard(String playerUsername, int pos) Requests to draw a building card from the lower building card list.voiddrawLowerTribeCard(String playerUsername, int pos) Requests to draw a tribe card from the lower tribe card list.voiddrawUpperBuildingCard(String playerUsername, int pos) Requests to draw a building card from the upper building card list.voiddrawUpperTribeCard(String playerUsername, int pos) Requests to draw a tribe card from the upper tribe card list.joinGame(String username, int preferredInt, IClientCallback callback) Adds a player to the game and registers the callback used by the server to notify the corresponding RMI client.voidHeartbeat method called periodically by the client to signal that it is still connected.voidRequests to skip the current player's optional action.voidslotChoice(String playerUsername, int pos) Requests to assign the specified player to a slot.voidtotemChoice(String playerUsername, String totems) Requests to assign the selected totem to the specified player.
-
Method Details
-
joinGame
ErrorType joinGame(String username, int preferredInt, IClientCallback callback) throws RemoteException Adds a player to the game and registers the callback used by the server to notify the corresponding RMI client.- Parameters:
username- the username chosen by the player.preferredInt- the desired number of players proposed by this client.callback- the remote callback associated with the client.- Returns:
nullif the player joins successfully; anErrorTypevalue describing the rejection otherwise.- Throws:
RemoteException- if an RMI communication error occurs.
-
drawUpperTribeCard
Requests to draw a tribe card from the upper tribe card list.- Parameters:
playerUsername- the username of the player performing the action.pos- the position of the selected card.- Throws:
RemoteException- if an RMI communication error occurs.
-
drawLowerTribeCard
Requests to draw a tribe card from the lower tribe card list.- Parameters:
playerUsername- the username of the player performing the action.pos- the position of the selected card.- Throws:
RemoteException- if an RMI communication error occurs.
-
drawUpperBuildingCard
Requests to draw a building card from the upper building card list.- Parameters:
playerUsername- the username of the player performing the action.pos- the position of the selected card.- Throws:
RemoteException- if an RMI communication error occurs.
-
drawLowerBuildingCard
Requests to draw a building card from the lower building card list.- Parameters:
playerUsername- the username of the player performing the action.pos- the position of the selected card.- Throws:
RemoteException- if an RMI communication error occurs.
-
skipTurn
Requests to skip the current player's optional action.- Parameters:
playerUsername- the username of the player skipping the action.- Throws:
RemoteException- if an RMI communication error occurs.
-
slotChoice
Requests to assign the specified player to a slot.- Parameters:
playerUsername- the username of the player making the slot choice.pos- the position of the selected slot.- Throws:
RemoteException- if an RMI communication error occurs.
-
totemChoice
Requests to assign the selected totem to the specified player.- Parameters:
playerUsername- the username of the player making the totem choice.totems- the name of the selected totem.- Throws:
RemoteException- if an RMI communication error occurs.
-
ping
Heartbeat method called periodically by the client to signal that it is still connected.This method mirrors the PING/PONG mechanism used in the TCP heartbeat channel.
- Parameters:
username- the username of the client sending the heartbeat ping.- Throws:
RemoteException- if an RMI communication error occurs.
-
disconnectPlayer
Notifies the server of a voluntary disconnection for the specified player.- Parameters:
username- the username of the player disconnecting.- Throws:
RemoteException- if an RMI communication error occurs.
-