Class OpenPatricianServerJFX
- java.lang.Object
-
- ch.sahits.game.openpatrician.server.OpenPatricianServerJFX
-
@Component public class OpenPatricianServerJFX extends java.lang.Object
Server of the Openpatrician Game- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Sep 17, 2011
-
-
Field Summary
Fields Modifier and Type Field Description private org.springframework.context.ApplicationContext
context
private EngineFactory
engineFactory
private java.util.List<AbstractEngine>
engines
Store all the engines here, to at least avoid them to be garbage collectedprivate IGame
game
private GameFactory
gameFactory
private int
numberOfPlayers
private com.google.common.eventbus.AsyncEventBus
serverEventBus
private boolean
started
private java.util.concurrent.Executor
threadPool
private ClockTickTimer
timer
-
Constructor Summary
Constructors Constructor Description OpenPatricianServerJFX()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addEngine(AbstractEngine engine)
Add an engine and all its children.void
addMultiplayer()
Add a player to the multiplayer game.private void
createAndInitAIPlayers(int nbAIPlayers, long initialcash)
Create the remaining players as artificial players(package private) int
getNumberOfPlayers()
void
startGame(IGame game, int nbHumanPlayers)
Timer that let the game time progressvoid
startStandaloneGame(IPlayer player)
Create a standalone game
-
-
-
Field Detail
-
numberOfPlayers
private int numberOfPlayers
-
engines
private java.util.List<AbstractEngine> engines
Store all the engines here, to at least avoid them to be garbage collected
-
game
private IGame game
-
threadPool
@Autowired @Qualifier("serverThreadPool") private java.util.concurrent.Executor threadPool
-
gameFactory
@Autowired private GameFactory gameFactory
-
serverEventBus
@Autowired @Qualifier("serverEventBus") private com.google.common.eventbus.AsyncEventBus serverEventBus
-
context
@Autowired private org.springframework.context.ApplicationContext context
-
engineFactory
@Autowired private EngineFactory engineFactory
-
timer
@Autowired private ClockTickTimer timer
-
started
private boolean started
-
-
Method Detail
-
startGame
public void startGame(IGame game, int nbHumanPlayers)
Timer that let the game time progress
-
startStandaloneGame
public void startStandaloneGame(IPlayer player)
Create a standalone game- Parameters:
player
- identifing the human player UI
-
createAndInitAIPlayers
private void createAndInitAIPlayers(int nbAIPlayers, long initialcash)
Create the remaining players as artificial players- Parameters:
nbAIPlayers
- number of AI playersinitialcash
- initial cash amount
-
addEngine
private void addEngine(AbstractEngine engine)
Add an engine and all its children.- Parameters:
engine
- to be added
-
addMultiplayer
public void addMultiplayer()
Add a player to the multiplayer game. If all players are added the the game is started
-
getNumberOfPlayers
int getNumberOfPlayers()
-
-