Class PlayerGUI

All Implemented Interfaces:
PlayerI, Serializable, Remote

public class PlayerGUI extends Player implements Serializable, PlayerI
class which represent the player on the client side, mutable, implements Serializable because it will be sent in the socket network
See Also:
  • Constructor Details

    • PlayerGUI

      public PlayerGUI(Player p) throws RemoteException
      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

      public PlayerGUI(NetMode mode, String opt) throws RemoteException
      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

      public void clone(PlayerGUI p)
      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

      public void connectionLost(Exception e)
      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

      public void receivedEventRMI(Message msg)
      method (called from remote) that is the equivalent of wait for events of the socket version
      Specified by:
      receivedEventRMI in interface PlayerI
      Parameters:
      msg - the message received from the server
    • sendToServer

      public void sendToServer(Message msg)
      general method to send a message to the server, it chooses the right network connection of the player
      Specified by:
      sendToServer in interface PlayerI
      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 interface PlayerI
    • initGUI

      public void initGUI()
      Function that initialize all the GUI