private EventHandler<MouseEvent> createAcceptOffer() { return mouseEvent -> { try { // post DisplayStateMessage LocalDateTime weddingDate = date.getCurrentDate().plusDays(21); MarriageAnnouncementState announcementState = MarriageAnnouncementState.builder() .date(date.getCurrentDate()) .player(state.getPlayer()) .spouse(state.getSpouse()) .weddingDate(weddingDate) .build(); DisplayStateMessage message = new DisplayStateMessage("ch.sahits.game.openpatrician.engine.event.EventEngine.message.marriage.title", announcementState); clientServerEventBus.post(new TargetedEvent((IHumanPlayer) state.getPlayer(), message)); // TODO: 12.03.17 why do we have a targeted event here? we can sending it directly, as the user is the target. clientEventBus.post(announcementState); // Schedule the celebration CelebrationTask task = taskFactory.getMarriageCelebrationEvent(weddingDate, state.getPlayer(), state.getPlayer().getHometown(), state.getSpouse()); taskList.add(task); } catch (RuntimeException e) { logger.error("Failed to order marriage celebrations", e); } }; } }
addDecoratedText("letter.location.date", "dateLocation", Pos.CENTER_RIGHT, state.getLocation(), letterDate); addVerticalSpacer(20); if (state.getPlayer().getPersonalData().isMale()) { addDecoratedText("letter.salutation.male", "salutationMale", state.getPlayer().getLastName()); } else { addDecoratedText("letter.salutation.female", "salutationFemale", state.getPlayer().getLastName()); if (state.getPlayer().getPersonalData().isMale()) { addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.MarriageOfferDialog.content.male", "contentMale", state.getSpouse().getName(), state.getSpouse().getLastName(), state.getSpouse().getBirthPlace().getName()); } else {