CelebrationTask task = taskFactory.getMarriageCelebrationEvent(weddingDate, player, hometown, offer.getSpouse()); taskList.add(task);
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("ch.sahits.game.openpatrician.display.dialog.event.MarriageOfferDialog.content.male", "contentMale", state.getSpouse().getName(), state.getSpouse().getLastName(), state.getSpouse().getBirthPlace().getName()); } else { addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.MarriageOfferDialog.content.female", "contentFemale", state.getSpouse().getName(), state.getSpouse().getLastName(), state.getSpouse().getBirthPlace().getName()); background.setFitWidth(200); background.setPreserveRatio(true); String portraitResouce = state.getSpouse().getPortraitResourceName(); ImageView portrait = new ImageView(imgLoader.loadImage(portraitResouce)); portrait.setFitWidth(200);