Class CityPlayerProxyJFX

  • All Implemented Interfaces:
    ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX

    public class CityPlayerProxyJFX
    extends java.lang.Object
    implements ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
    State information of the player, the city and the ships. This instance is tied to the ClientViewState.
    • Constructor Summary

      Constructors 
      Constructor Description
      CityPlayerProxyJFX​(ch.sahits.game.openpatrician.model.city.ICity city, ch.sahits.game.openpatrician.model.IHumanPlayer player, ch.sahits.game.openpatrician.model.ship.INavigableVessel activeShip)
      /** Constructor initializing the city and the player with one ship in port.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activateShip​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
      Activate a ship.
      javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.INavigableVessel> activeShipProperty()  
      void arrive​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
      A ship arrives in the city
      javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.city.ICity> cityProperty()  
      ch.sahits.game.openpatrician.model.ship.INavigableVessel getActiveShip()  
      ch.sahits.game.openpatrician.model.city.ICity getCity()  
      javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getPlayersNavalVessels()  
      javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> getPlayersShips()  
      void handleShipBecomesUnavailable​(ch.sahits.game.openpatrician.event.data.ShipBecomesUnavailableEvent event)  
      void handleShipConstructionFinished​(ch.sahits.game.openpatrician.event.data.ShipConstructionFinishedEvent event)
      Handle the event where a ships construction is finished, by adding the ship to the players ships, if the city is the current city.
      void handleShipEntersPort​(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)  
      void handleShipLeavesPort​(ch.sahits.game.openpatrician.event.data.ShipLeavingPort event)  
      void leave​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
      Ship leave the city
      void postLoad()
      Execute after savegame was loaded triggered from the ClientViewState.
      void setCity​(ch.sahits.game.openpatrician.model.city.ICity city)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX

        getPlayer
    • Constructor Detail

      • CityPlayerProxyJFX

        public CityPlayerProxyJFX​(ch.sahits.game.openpatrician.model.city.ICity city,
                                  ch.sahits.game.openpatrician.model.IHumanPlayer player,
                                  ch.sahits.game.openpatrician.model.ship.INavigableVessel activeShip)
        /** Constructor initializing the city and the player with one ship in port.
        Parameters:
        city - behind the proxy
        player - human player behind the proxy
        activeShip - active ship behind the proxy.
    • Method Detail

      • activateShip

        public void activateShip​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
        Activate a ship. If the ship is not one of the players or not in port or not available an IllegalArgumentException will be thrown
        Specified by:
        activateShip in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
        Parameters:
        ship - that is to be activated.
        Throws:
        java.lang.IllegalArgumentException - if the ship cannot be activated due to its non existence
      • getPlayersNavalVessels

        public javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getPlayersNavalVessels()
        Specified by:
        getPlayersNavalVessels in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • arrive

        public void arrive​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
        A ship arrives in the city
        Specified by:
        arrive in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
        Parameters:
        ship - that arrives
      • leave

        public void leave​(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
        Ship leave the city
        Specified by:
        leave in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
        Parameters:
        ship - that leaves
      • getPlayersShips

        public javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> getPlayersShips()
        Specified by:
        getPlayersShips in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • handleShipLeavesPort

        public void handleShipLeavesPort​(ch.sahits.game.openpatrician.event.data.ShipLeavingPort event)
      • handleShipEntersPort

        public void handleShipEntersPort​(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
      • handleShipBecomesUnavailable

        public void handleShipBecomesUnavailable​(ch.sahits.game.openpatrician.event.data.ShipBecomesUnavailableEvent event)
      • postLoad

        public void postLoad()
        Execute after savegame was loaded triggered from the ClientViewState.
      • getActiveShip

        public ch.sahits.game.openpatrician.model.ship.INavigableVessel getActiveShip()
        Specified by:
        getActiveShip in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • activeShipProperty

        public javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.INavigableVessel> activeShipProperty()
        Specified by:
        activeShipProperty in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • getCity

        public ch.sahits.game.openpatrician.model.city.ICity getCity()
        Specified by:
        getCity in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • cityProperty

        public javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.city.ICity> cityProperty()
        Specified by:
        cityProperty in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • setCity

        public void setCity​(ch.sahits.game.openpatrician.model.city.ICity city)
        Specified by:
        setCity in interface ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
      • handleShipConstructionFinished

        public void handleShipConstructionFinished​(ch.sahits.game.openpatrician.event.data.ShipConstructionFinishedEvent event)
        Handle the event where a ships construction is finished, by adding the ship to the players ships, if the city is the current city. At this point the new ship has been added to the fleet.
        Parameters:
        event - for the finishing of a ship construction