/** * Initialize the player that goes with this client. The player does not change later on, * @param newGameDTO parameter object for the new game client */ @Subscribe public void initializeState(NewGameClient newGameDTO) { final IPlayer player = newGameDTO.getPlayer(); initializeMapImage(player); }
private void handleNewGame(NewGame newGameDTO) { PropertyInitializer propInit = serverContext.getBean(PropertyInitializer.class); propInit.setKeySuffix(newGameDTO.getDifficulty().getLevel()); serverContext.getBean("dependentPropertyInitializer"); // Force initialisation IHumanPlayer player = startupGameEnvironment(newGameDTO); // todo: andi 18/01/14: notify the client so the GameStatus can be updated NewGameClient newGameClientDTO = NewGameClient.builder().player(player).build(); clientServerEventBus.post(new ResumeGame()); clientServerEventBus.post(newGameClientDTO); }
/** * Initialize the player that goes with this client. The player does not change later on, * @param newGameDTO parameter object for the new game */ @Subscribe public void initializeState(NewGameClient newGameDTO) { this.player = newGameDTO.getPlayer(); state.setValue(EViewState.CITY); IShip activeShip = null; for (IShip ship : player.getFleet()) { if (ship.isAvailable()) { activeShip = ship; break; } } ICityPlayerProxyJFX proxy = (ICityPlayerProxyJFX) context.getBean("cityPlayerProxy", player.getHometown(), player, activeShip); currentCityProxy = Optional.of(proxy); } @Subscribe