コード例 #1
0
ファイル: TreasureView.java プロジェクト: Nitrosito/PDOO
 public void setTreasure(Treasure tesoro) {
   treasureModel = tesoro;
   this.nombretesoro.setText(treasureModel.getName());
   this.bonustesoro.setText(Integer.toString(treasureModel.getBonus()));
   this.tipotesoro.setText(treasureModel.getType().toString());
   repaint();
 }
コード例 #2
0
ファイル: TreasureView.java プロジェクト: burflip/napakalaki
 void setTreasure(Treasure t) {
   treasureModel = t;
   System.out.println("/treasures/" + treasureModel.getName() + ".jpg");
   cardLabel.setIcon(
       new javax.swing.ImageIcon(
           getClass().getResource("/treasures/" + treasureModel.getName() + ".jpg")));
   repaint();
 }
コード例 #3
0
  private int showTreasures(String message, ArrayList<Treasure> treasures, boolean menu) {
    int optionMenu = Command.GoBack.menu;

    System.out.println("\n------- ------- ------- ------- ------- ------- -------");
    System.out.println(message + "\n");
    if (menu) System.out.println("\n" + Command.GoBack.menu + " : " + Command.GoBack.text);

    for (Treasure t : treasures) {
      optionMenu++;
      System.out.println("\n" + (menu ? optionMenu + ":" : "") + t.toString());
    }
    return optionMenu;
  }
コード例 #4
0
ファイル: TreasureInfo.java プロジェクト: Lifka/Napakalaki
  public void setTreasure(Treasure t) {
    treasureModel = t;

    String varname = treasureModel.getName();
    name.setText(varname);
    setImage(varname);

    tipo.setText(treasureModel.getType().toString());

    bonmin.setText(Integer.toString(treasureModel.getMinBonus()));
    bonmax.setText(Integer.toString(treasureModel.getMaxBonus()));
    coins.setText(Integer.toString(treasureModel.getGoldCoins()));
    setTitle(varname);
    repaint();
  }
コード例 #5
0
  private Command processCommand(Command command, Player aPlayer) {
    Treasure aTreasure;

    switch (command) {
      case Exit:
        break;
      case Combat:
        break;
      case ShowMonster:
        System.out.println("\n------- ------- ------- ------- ------- ------- ------- ");
        System.out.println("El monstruo actual es:\n\n" + game.getCurrentMonster().toString());
        break;
      case ShowVisibleTreasure:
        showTreasures("Esta es tu lista de tesoros visibles", aPlayer.getVisibleTreasures(), false);
        break;
      case ShowHiddenTreasure:
        showTreasures("Esta es tu lista de tesoros ocultos", aPlayer.getHiddenTreasures(), false);
        break;
      case MakeTreasureVisible:
        manageMakeTreasureVisible(aPlayer);
        break;
      case DiscardVisibleTreasure:
        manageDiscardTreasures(true, aPlayer);
        break;
      case DiscardHiddenTreasure:
        manageDiscardTreasures(false, aPlayer);
        break;
      case DiscardAll:
        aPlayer.discardAllTreasures();
        break;
      case StealTreasure:
        aTreasure = aPlayer.stealTreasure();
        if (aTreasure == null) System.out.println("\n\n No has podido robar nada \n\n");
        else System.out.println("\n\n Has robado este tesoro: \n\n" + aTreasure.toString());
        break;
      case NextTurn:
        if (!game.nextTurn()) {
          System.out.println("\n\n ERROR \n");
          System.out.println("No cumples las condiciones para pasar de turno.");
          System.out.println("O bien tienes más de 4 tesoros ocultos");
          System.out.println("O bien te queda mal rollo por cumplir");
        } else {
          command = Command.NextTurnAllowed;
        }
        break;
    }
    return command;
  }