Class 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 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
      • started

        private boolean started
    • Constructor Detail

      • OpenPatricianServerJFX

        public OpenPatricianServerJFX()
    • 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 players
        initialcash - 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()