/** * Add the action button centered at the bottom. * @param textKey for the label on the button * @param id for the button * @return button */ public OpenPatricianLargeWaxButton addActionButton(String textKey, String id) { OpenPatricianLargeWaxButton button = new OpenPatricianLargeWaxButton(messageSource.getMessage(textKey, new Object[]{}, locale.getCurrentLocal())); button.setId(id); final int actionButtonX = (WIDTH - 124) / 2; button.setLayoutX(actionButtonX); button.setLayoutY(CLOSE_BTN_Y_POS - 24); getContent().add(button); return button; }
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.LeaveConvoyDialog.title", new Object[]{}, locale.getCurrentLocal())); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.LeaveConvoyDialog.text", new Object[]{ship.getName(), convoy.getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); OpenPatricianLargeWaxButton acceptBtn = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.LeaveConvoyDialog.leave", new Object[]{}, locale.getCurrentLocal())); acceptBtn.getStyleClass().add("actionButton"); acceptBtn.setId("actionButton"); acceptBtn.setLayoutX(BUTTON_X); acceptBtn.setOnAction(createAcceptHandler(ship)); acceptBtn.setLayoutY(UPPER_BUTTON_Y); getContent().addAll(box, acceptBtn); }
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernInformantDialogPageOne.title", new Object[]{informant.getName()}, locale.getCurrentLocal())); String loadedText = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernInformantDialogPageOne.dialog", new Object[0], locale.getCurrentLocal()); HashMap<String, Object> parameters = new HashMap<>(); final int price = informant.getPrice(city.getPlayer()); parameters.put("price", price); DecoratedText dt = decoratedTextFactory.createDecoratedText(loadedText, parameters); final OpenPatricianLargeWaxButton acceptButton = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernInformantDialogPageOne.buy", new Object[]{}, locale.getCurrentLocal())); acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2; acceptButton.setLayoutX(BUTTON_X); int LOWER_BUTTON_Y = CLOSE_BTN_Y_POS - 24; acceptButton.setLayoutY(LOWER_BUTTON_Y); acceptButton.setOnAction(mouseEvent -> { try { city.getPlayer().getCompany().updateCash(-price); clientEventBus.post(new ViewChangeEvent(MainGameView.class, EDialogType.TAVERN_INFORMANT_2)); } catch (RuntimeException e) { logger.error("Failed to accept informant offer", e); } }); getContent().addAll(dt, acceptButton); }
private void initializeDissolveConvoyDialog(IConvoy vessel) { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.ConvoyDialog.dissolveTitle", new Object[]{}, locale.getCurrentLocal())); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.ConvoyDialog.areYouSure", new Object[]{vessel.getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); final int actionButtonX = (WIDTH - 124) / 2; String s = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.ConvoyDialog.dissolve", new Object[]{}, locale.getCurrentLocal()); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setId("dissolve"); ICity city = viewState.getCurrentCityProxy().get().getCity(); action.setOnAction(dissolve(vessel, city)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); getContent().addAll(box, action); }
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.title", new Object[]{}, locale.getCurrentLocal())); ICity town = city.getCity(); IPlayer player = city.getPlayer(); resetContent(town, player); final int actionButtonX = (WIDTH - 124) / 2; final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.petition", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(box, action)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!canPosePetition(town, player)); // should be disabled when the petition cannot be posed getContent().addAll(action); clientServerEventBus.register(this); timerEventBus.register(this); }
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.JoinGuildDialog.title", new Object[]{}, locale.getCurrentLocal())); IHumanPlayer player = city.getPlayer(); ICity city = this.city.getCity(); int fee = guildService.getEntryFee(player); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.JoinGuildDialog.text", new Object[]{city.getName(), player.getName(), player.getLastName(), fee}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); String s = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.JoinGuildDialog.joinBtn", new Object[]{}, locale.getCurrentLocal()); OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setId("joinGuild"); final int actionButtonX = (WIDTH - 124) / 2; action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setOnAction(joinGuild(player, city, fee)); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); getContent().addAll(box, action); }
acceptBtn = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); acceptBtn.getStyleClass().add("actionButton"); acceptBtn.setLayoutX(BUTTON_X); acceptBtn.setOnAction(createAcceptHandler()); OpenPatricianLargeWaxButton nextBtn = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.next", new Object[]{}, locale.getCurrentLocal())); nextBtn.getStyleClass().add("actionButton"); nextBtn.setLayoutX(BUTTON_X); nextBtn.setLayoutY(LOWER_BUTTON_Y); nextBtn.setOnAction(createNextPersonHandler());
action.getStyleClass().add("actionButton"); action.setOnAction(getAction(contract)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!capableShipPresent.get()); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(minStrength, refund)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!capableShipPresent.get());
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.church.ChurchGiftDialog.title", new Object[]{}, locale.getCurrentLocal())); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.church.ChurchGiftDialog.introText", new Object[]{}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); final ICompany company = city.getPlayer().getCompany(); moneyTransfer = fxUtils.getMoneyTransfer(imageLoader); moneyTransfer.setStepSize(500); moneyTransfer.maxTransfereableProperty().bind(company.cashProperty()); moneyTransfer.setAmount(0); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); moneyTransfer.setPadding(new Insets(100, 0, 0, 100)); box.getChildren().addAll(moneyTransfer); final int actionButtonX = (WIDTH - 124) / 2; String s = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.church.ChurchFeedingDialog.donate", new Object[]{}, locale.getCurrentLocal()); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setOnAction(getAction()); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding(); action.setDisable(!actionEnabled.get()); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue)); getContent().addAll(box, action); }
wholeHanse.setLayoutX(xFirstButton); wholeHanse.setLayoutY(CLOSE_BTN_Y_POS - 24); hirePirateEventHandler = event -> { OpenPatricianLargeWaxButton local = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernPirateDialog.local", new Object[]{city.getCity().getName()}, locale.getCurrentLocal())); local.getStyleClass().add("actionButton"); local.setLayoutX(xSecondButton); local.setLayoutY(CLOSE_BTN_Y_POS - 24); local.setOnAction(new WeakEventHandler<>(hirePirateEventHandler));
action.getStyleClass().add("actionButton"); action.setOnAction(getAction(church)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding();
meetings.setId("meetings"); meetings.setOnAction(createMeetingsAction()); meetings.setLayoutX(actionButtonX); meetings.setLayoutY(CLOSE_BTN_Y_POS - 24); if (city.getPlayer().getRank() != ESocialRank.ALDERMAN) {
action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = new BooleanBinding() {
action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = new BooleanBinding() {
action.getStyleClass().add("actionButton"); action.setOnAction(getAction()); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding();
acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2; acceptButton.setLayoutX(BUTTON_X); int LOWER_BUTTON_Y = CLOSE_BTN_Y_POS - 24; acceptButton.setLayoutY(LOWER_BUTTON_Y);
action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding enableAction = new BooleanBinding() {
action.getStyleClass().add("actionButton"); action.setOnAction(getAction()); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24);
action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24);
acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2; acceptButton.setLayoutX(BUTTON_X); int LOWER_BUTTON_Y = CLOSE_BTN_Y_POS - 24; acceptButton.setLayoutY(LOWER_BUTTON_Y);