
ch.sahits.game.openpatrician.engine.event.task.ServerSideTaskFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenPatricianEngine Show documentation
Show all versions of OpenPatricianEngine Show documentation
Engine part driving the models and the game
package ch.sahits.game.openpatrician.engine.event.task;
import ch.sahits.game.openpatrician.annotation.ClassCategory;
import ch.sahits.game.openpatrician.annotation.DependentInitialisation;
import ch.sahits.game.openpatrician.annotation.EClassCategory;
import ch.sahits.game.openpatrician.client.ICityPlayerProxyJFX;
import ch.sahits.game.openpatrician.model.IPlayer;
import ch.sahits.game.openpatrician.model.city.impl.IShipBuildTask;
import ch.sahits.game.openpatrician.model.event.TimedTask;
import ch.sahits.game.openpatrician.model.ship.EShipType;
import ch.sahits.game.openpatrician.model.ship.EShipUpgrade;
import ch.sahits.game.openpatrician.model.ship.IShip;
import ch.sahits.game.openpatrician.util.StartNewGameBean;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
/**
* @author Andi Hotz, (c) Sahits GmbH, 2014
* Created on Mar 01, 2014
*/
@Service
@Lazy
@DependentInitialisation(StartNewGameBean.class)
@ClassCategory(EClassCategory.SINGLETON_BEAN)
public class ServerSideTaskFactory {
@Autowired
private ApplicationContext context;
/**
* Retrieve the ship repair task.
* @return
*/
public TimedTask getRepairTask(DateTime executionTime, IShip ship, ICityPlayerProxyJFX proxy) {
Object[] args = new Object[]{executionTime, ship, proxy};
return (RepairTask) context.getBean("repairTask", args);
}
/**
* Retrieve the ship build task.
* @return
*/
public IShipBuildTask getShipBuildTask(DateTime executionTime, EShipType type, IPlayer owner, double westPosition) {
Object[] args = new Object[]{executionTime, type, owner, westPosition};
return (ShipBuildTask) context.getBean("shipBuildTask", args);
}
/**
* Retrieve the ship refit task.
* @return
*/
public TimedTask getRefitShipTask(DateTime executionTime, IShip ship, EShipUpgrade upgrade, ICityPlayerProxyJFX proxy) {
Object[] args = new Object[]{executionTime, ship, upgrade, proxy};
return (RefitShipTask) context.getBean("refitShipTask", args);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy