コード例 #1
0
  /**
   * play a letter and check the match values, so if the user wins, the user receives an email with
   * the information of the match played
   *
   * @param position
   * @param letter
   * @return
   */
  public PlayLetterInfoTuple playLetter(int position, char letter) {
    Log.debug(TAG, "play letter: " + letter);
    boolean success = match.play(position, letter);
    if (match.isFinished() && match.isWon()) {
      NotificationService notificationService = null;
      try {
        notificationService =
            (NotificationService)
                ServiceLocator.getInstance().find(ServiceLocator.SERVICE_NOTIFICATION);
      } catch (Exception e) {
        e.printStackTrace();
      }

      if (notificationService != null) {
        notificationService.notifyWonMatch(
            player.getName() + " " + player.getSurname(),
            player.getEmail(),
            match.getWordName(),
            match.getScore(),
            match.getNumErrors());
      }
    }
    return new PlayLetterInfoTuple(
        success, match.isFinished(), match.isWon(), match.getScore(), match.getNumErrors());
  }
コード例 #2
0
 /** @return the word of the match */
 public String getMatchWord() {
   String matchWord = match.getWordName();
   Log.debug(TAG, "match word: " + matchWord);
   return matchWord;
 }