コード例 #1
0
ファイル: GameModel.java プロジェクト: tiksa/Jorma-s-Revenge
  public void updateVisibleOutput() {
    String output = null;
    if (!outputWaiting) {
      Cell playerCell = player.getCell();
      ArrayList<Item> items = playerCell.getItems();
      output = Util.capitalizeFirstLetter(player.getCell().getGroundProto().getName()) + ". ";
      if (!items.isEmpty()) {
        if (items.size() > 1) output += "Several items lying. ";
        else output += Util.capitalizeFirstLetter(items.get(0).getName()) + " lying. ";
      }
      output += outputTemp;
    } else output = outputTemp;

    output = Util.splitToLines(output, WIDTH_FOR_TEXT);
    int maxLength = (OUTPUTBOX_HEIGHT) * WIDTH_FOR_TEXT - (int) (WIDTH_FOR_TEXT * 0.7);
    if (visibleOutput.length() < maxLength) {
      if (output.length() > maxLength) {
        visibleOutput = output.substring(0, maxLength) + " ... PRESS SPACE TO READ MORE";
        outputTemp = output.substring(maxLength);
        outputWaiting = true;
      } else {
        visibleOutput = output;
        outputWaiting = false;
      }
    }
  }
コード例 #2
0
ファイル: GameModel.java プロジェクト: tiksa/Jorma-s-Revenge
 public void newTurn() {
   turn++;
   updateTime();
   currentMap.update(timeLeap);
   if (previousMapTimer > 0) {
     previousMap.update(timeLeap);
     previousMapTimer -= timeLeap;
   }
   player.update();
   for (Event e : events.getAddBuffer()) {
     addMessage(e.getMessage());
   }
   events.update(); // TODO: optimize double looping
 }