コード例 #1
0
 @FXML
 void onMouseClickGameStatus(MouseEvent mouseEvent) {
   GameStatus gameStatus = playerInfoBean.getGameStatus();
   if (gameStatus == GameStatus.NONE) {
     return;
   }
   if (mouseEvent.getButton() == MouseButton.PRIMARY && mouseEvent.getClickCount() == 2) {
     int uid = playerInfoBean.getGameUid();
     if (gameStatus == GameStatus.LOBBY || gameStatus == GameStatus.HOST) {
       GameInfoBean gameInfoBean = gameService.getByUid(uid);
       gamesController.onJoinGame(
           gameInfoBean, null, mouseEvent.getScreenX(), mouseEvent.getScreenY());
     } else if (gameStatus == GameStatus.PLAYING) {
       try {
         replayService.runLiveReplay(uid, playerInfoBean.getUsername());
       } catch (IOException e) {
         notificationService.addNotification(
             new ImmediateNotification(
                 i18n.get("errorTitle"),
                 i18n.get("replayCouldNotBeStarted.text"),
                 Severity.ERROR,
                 e,
                 singletonList(new ReportAction(i18n, reportingService, e))));
       }
     }
   }
 }
コード例 #2
0
  @FXML
  void onMouseEnterGameStatus() {
    if (playerInfoBean.getGameStatus() == GameStatus.NONE) {
      return;
    }

    GameStatusTooltipController gameStatusTooltipController =
        applicationContext.getBean(GameStatusTooltipController.class);
    gameStatusTooltipController.setGameInfoBean(gameService.getByUid(playerInfoBean.getGameUid()));

    Tooltip statusTooltip = new Tooltip();
    statusTooltip.setGraphic(gameStatusTooltipController.getRoot());
    Tooltip.install(statusImageView, statusTooltip);
  }