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, uiMode
Fields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clone the player on the client in the player on the servervoid
function that handle the eventual disconnectionvoid
initGUI()
Function that initialize all the GUIvoid
ping()
method that periodically pings the server from socket clientvoid
method that allow the server ping the RMI clientvoid
pingRMI()
method that periodically pings the server from RMI clientvoid
receivedEventRMI
(Message msg) method (called from remote) that is the equivalent of wait for events of the socket versionvoid
Send with socket network the message of the chat to the right playersvoid
sendToServer
(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, setPrivateObjective
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods 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:
receivedEventRMI
in 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:
sendToServer
in interfacePlayerI
- Parameters:
msg
- the message that must be sent
-
pingClient
public void pingClient()method that allow the server ping the RMI client- Specified by:
pingClient
in interfacePlayerI
-
initGUI
public void initGUI()Function that initialize all the GUI
-