Пример #1
0
  /**
   * 3枚拡大表示Viewから、対応する通常サイズカードViewを見つける
   *
   * @param bigCard
   * @return
   */
  private BattleCardView searchCardFromBigCard(BattleCardView bigCard) {

    BattleCardView view = null;
    BeetleCard info = bigCard.getCardInfo();
    ArrayList<BattleCardView> cards = this.activity.myInfo.getSelectedCard();
    for (BattleCardView selectedCard : cards) {
      if (info.equals(selectedCard.getCardInfo())) {
        // 一致したら入れ替える
        view = selectedCard;
        view.setUpFlag(false);
        break;
      }
    }
    return view;
  }
Пример #2
0
  /** 攻撃力と守備力の合計値を算出して表示する */
  private void calcAndViewTotal(ArrayList<BattleCardView> cards) {

    this.totalAttack = 0;
    this.totalDefense = 0;

    // 合計値加算
    for (BattleCardView card : cards) {
      int type = card.getCardInfo().getType();
      if (type == 3) {
        // 攻撃力加算
        this.totalAttack += card.getCardInfo().getAttack();
      } else if (type == 4) {
        // 守備力加算
        this.totalDefense += card.getCardInfo().getDefense();
      }
    }
    // 攻撃力合計
    ((TextView) this.activity.findViewById(R.id.battle_total_attack))
        .setText(Integer.toString(this.totalAttack));

    // 守備力合計
    ((TextView) this.activity.findViewById(R.id.battle_total_defense))
        .setText(Integer.toString(this.totalDefense));
  }
Пример #3
0
  /**
   * カード詳細を画面に表示する
   *
   * @param left
   * @param top
   */
  public void viewDetailCards(View view, int left, int top) {

    BattleCardView card = (BattleCardView) view;

    // Densityの値を取得
    float tmpDensity = this.activity.getResources().getDisplayMetrics().density;

    // CARD用View取得
    this.myViewCardDerail =
        ((LayoutInflater) this.activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.card_detailview, null);

    int posLeft = (int) (this.activity.baseLayout.getWidth() / 2 - 266 * tmpDensity / 2);

    BattleLayout.LayoutParams cartParams =
        new BattleLayout.LayoutParams((int) (266 * tmpDensity), (int) (400 * tmpDensity));
    cartParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    cartParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    cartParams.setMargins((int) (posLeft), (int) (top * tmpDensity), 0, 0);

    // 名前
    ((TextView) this.myViewCardDerail.findViewById(R.id.carddetail_name))
        .setText(card.getCardInfo().getName());

    // 画像設定
    ((ImageView) this.myViewCardDerail.findViewById(R.id.carddetail_icon))
        .setImageResource(card.getCardInfo().getImageResourceId(this.activity));

    // 属性設定
    CardAttribute attr = card.getCardInfo().getAttribute();
    if (attr == CardAttribute.FIRE) {
      ((ImageView) this.myViewCardDerail.findViewById(R.id.carddetail_attrribute))
          .setImageResource(R.drawable.fire);
    } else if (attr == CardAttribute.WATER) {
      ((ImageView) this.myViewCardDerail.findViewById(R.id.carddetail_attrribute))
          .setImageResource(R.drawable.water);
    } else if (attr == CardAttribute.WIND) {
      ((ImageView) this.myViewCardDerail.findViewById(R.id.carddetail_attrribute))
          .setImageResource(R.drawable.wind);
    }

    int type = card.getCardInfo().getType();
    if (type == 3) {

      // 背景設定
      ((RelativeLayout) this.myViewCardDerail.findViewById(R.id.carddetail_bg))
          .setBackgroundResource(R.drawable.card_red);

      // 攻、守
      // 表示文字設定
      ((TextView) this.myViewCardDerail.findViewById(R.id.carddetail_atk))
          .setText("攻撃:" + Integer.toString(card.getCardInfo().getAttack()));
    }
    if (type == 4) {

      // 背景設定
      ((RelativeLayout) this.myViewCardDerail.findViewById(R.id.carddetail_bg))
          .setBackgroundResource(R.drawable.card_blue);

      // 攻、守
      // 表示文字設定
      ((TextView) this.myViewCardDerail.findViewById(R.id.carddetail_def))
          .setText("守備:" + Integer.toString(card.getCardInfo().getDefense()));
    }

    // 説明
    ((TextView) this.myViewCardDerail.findViewById(R.id.carddetail_intoro))
        .setText("説明:" + card.getCardInfo().getIntroduction());

    // 戦闘ベース部品にカード詳細を追加する
    this.activity.baseLayout.addView(this.myViewCardDerail, cartParams);
  }