@Override public void postLoad() { state.setValue(EViewState.CITY); PlayerList players = context.getBean(PlayerList.class); for (IPlayer curPlayer : players) { if (curPlayer instanceof IHumanPlayer) { this.player = (IHumanPlayer) curPlayer; break; } } CityPlayerProxyJFX proxy = (CityPlayerProxyJFX) context.getBean("cityPlayerProxy", player.getHometown(), player, null); currentCityProxy = Optional.of(proxy); proxy.postLoad(); } }
/** * 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
@Override public LinkedHashSet<NoticeBoardMenuEntry> createMenuEntries(ICityPlayerProxyJFX proxy, ENoticeBoardType type) { LinkedHashSet<NoticeBoardMenuEntry> entries = new LinkedHashSet<>(); String s; if (type == ENoticeBoardType.ARMORY) { if (proxy.getPlayer().getRank() == ESocialRank.ALDERMAN || (proxy.getPlayer().getHometown().equals(proxy.getCity()) && proxy.getPlayer().getRank() == ESocialRank.MAYOR)) { s = messageSource.getMessage("ch.sahits.game.openpatrician.display.notice.NoticeBoardFactory.armory.handWeapon", new Object[]{}, locale.getCurrentLocal()); NoticeBoardMenuEntry entry = createNoticeBoardEntry(s, EDialogType.ARMORY_HAND_WEAPONS); entry.disabledProperty().setValue(true); entries.add(entry); } s = messageSource.getMessage("ch.sahits.game.openpatrician.display.notice.NoticeBoardFactory.armory.shipWeapon", new Object[]{}, locale.getCurrentLocal()); NoticeBoardMenuEntry entry = createNoticeBoardEntry(s, EDialogType.ARMORY_SHIP_WEAPONS); entries.add(entry); } return entries; } }
@Subscribe public void handleNewGameStart(NewGameClient newGameDTO) { Platform.runLater(() -> { gameStatus.bindToPlayer(newGameDTO.getPlayer()); viewStatus.setCity(newGameDTO.getPlayer().getHometown().getName()); clientServerEventBus.unregister(this); }); }
NoticeBoardMenuEntry entry = createNoticeBoardEntry(s, EDialogType.CITY_HALL_HANSEATIC_INFO); entries.add(entry); if (proxy.getPlayer().getRank() == ESocialRank.ALDERMAN && proxy.getPlayer().getHometown().equals(proxy.getCity())) { // FIXME: 12/19/15 this only works if the player is alderman, cannot open if anyone else is alderman s = messageSource.getMessage("ch.sahits.game.openpatrician.display.notice.NoticeBoardFactory.aldermanOffice", new Object[]{}, locale.getCurrentLocal()); entry = createNoticeBoardEntry(s, EDialogType.CITY_HALL_ALDERMAN_OFFICE);
ICity bestCity = city.getPlayer().getHometown(); // default long reputation = 0; for (ICity c : cities) {
OpenPatricianLargeWaxButton withdraw = new OpenPatricianLargeWaxButton(template); withdraw.getStyleClass().add("actionButton"); if (!city.getPlayer().getRank().equals(ESocialRank.MAYOR) || !city.getPlayer().getHometown().equals(city.getCity())) { withdraw.setVisible(false);