Package it.polimi.ingsw.view.GUI
Class PlayerGUI
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
it.polimi.ingsw.view.Player
it.polimi.ingsw.view.GUI.PlayerGUI
- All Implemented Interfaces:
PlayerI,Serializable,Remote
class which represent the player on the client side, mutable,
implements Serializable because it will be sent in the socket network
- See Also:
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.Player
activeName, board, chairmanName, closed, CO_1_Done, CO_2_Done, endGame, fullChat, inStream, isChairMan, librariesOfOtherPlayers, library, mySocket, name, netMode, numPlayers, objective, outStream, pingTimeout, pointsMap, pointsUntilNow, showErrors, turnThread, uiModeFields inherited from class java.rmi.server.RemoteObject
ref -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClone the player on the client in the player on the servervoidfunction that handle the eventual disconnectionvoidinitGUI()Function that initialize all the GUIvoidping()method that periodically pings the server from socket clientvoidmethod that allow the server ping the RMI clientvoidpingRMI()method that periodically pings the server from RMI clientvoidreceivedEventRMI(Message msg) method (called from remote) that is the equivalent of wait for events of the socket versionvoidSend with socket network the message of the chat to the right playersvoidsendToServer(Message msg) general method to send a message to the server, it chooses the right network connection of the playerMethods inherited from class it.polimi.ingsw.view.Player
checkRawCoords, clone, doesPlayerExists, getCO_1_Done, getCO_2_Done, getEndGame, getFullChat, getInStream, getIsChairMan, getName, getPrivateObjective, pickCards, setIsChairMan, setName, setPrivateObjectiveMethods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
Constructor Details
-
PlayerGUI
constructor that copies a generic Player object inside a new PlayerTUI object- Parameters:
p- the Player object to copy, received by the server- Throws:
RemoteException
-
PlayerGUI
standard constructor, starts the main game process on the client side- Parameters:
mode- type of the network chosen by the user- Throws:
RemoteException
-
-
Method Details
-
clone
Clone the player on the client in the player on the server- Parameters:
p- the Player that will be cloned in the current Object
-
sendChatMsg
public void sendChatMsg()Send with socket network the message of the chat to the right players -
connectionLost
function that handle the eventual disconnection- Parameters:
e- the exception to throw
-
ping
public void ping()method that periodically pings the server from socket client -
pingRMI
public void pingRMI()method that periodically pings the server from RMI client -
receivedEventRMI
method (called from remote) that is the equivalent of wait for events of the socket version- Specified by:
receivedEventRMIin interfacePlayerI- Parameters:
msg- the message received from the server
-
sendToServer
general method to send a message to the server, it chooses the right network connection of the player- Specified by:
sendToServerin interfacePlayerI- Parameters:
msg- the message that must be sent
-
pingClient
public void pingClient()method that allow the server ping the RMI client- Specified by:
pingClientin interfacePlayerI
-
initGUI
public void initGUI()Function that initialize all the GUI
-