Class CityPlayerProxyJFX
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.model.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.ICityPlayerProxyJFXState 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 voidactivateShip(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)Activate a ship.javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.INavigableVessel>activeShipProperty()voidarrive(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)A ship arrives in the cityjavafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.city.ICity>cityProperty()ch.sahits.game.openpatrician.model.ship.INavigableVesselgetActiveShip()ch.sahits.game.openpatrician.model.city.ICitygetCity()javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.INavigableVessel>getPlayersNavalVessels()javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip>getPlayersShips()voidhandleShipBecomesUnavailable(ch.sahits.game.openpatrician.event.data.ShipBecomesUnavailableEvent event)voidhandleShipConstructionFinished(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.voidhandleShipEntersPort(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)voidhandleShipLeavesPort(ch.sahits.game.openpatrician.event.data.ShipLeavingPort event)voidleave(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)Ship leave the cityvoidpostLoad()Execute after savegame was loaded triggered from the ClientViewState.voidsetCity(ch.sahits.game.openpatrician.model.city.ICity city)
-
-
-
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 proxyplayer- human player behind the proxyactiveShip- 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 anIllegalArgumentExceptionwill be thrown- Specified by:
activateShipin interfacech.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:
getPlayersNavalVesselsin interfacech.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:
arrivein interfacech.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:
leavein interfacech.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:
getPlayersShipsin interfacech.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:
getActiveShipin interfacech.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
-
activeShipProperty
public javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.INavigableVessel> activeShipProperty()
- Specified by:
activeShipPropertyin interfacech.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
-
getCity
public ch.sahits.game.openpatrician.model.city.ICity getCity()
- Specified by:
getCityin interfacech.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
-
cityProperty
public javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.city.ICity> cityProperty()
- Specified by:
cityPropertyin interfacech.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX
-
setCity
public void setCity(ch.sahits.game.openpatrician.model.city.ICity city)
- Specified by:
setCityin interfacech.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
-
-