Ejemplo n.º 1
0
    private StackInstanceDisplay(StackItemView stackInstance0, float width) {
      stackInstance = stackInstance0;
      CardView card = stackInstance.getSourceCard();

      text = stackInstance.getText();
      if (stackInstance.isOptionalTrigger()
          && stackInstance0
              .getActivatingPlayer()
              .equals(MatchController.instance.getCurrentPlayer())) {
        text = "(OPTIONAL) " + text;
      }

      // TODO: A hacky workaround is currently used to make the game not leak the color information
      // for Morph cards.
      final CardStateView curState = card.getCurrentState();
      final boolean isFaceDown = curState.getState() == CardStateName.FaceDown;
      final DetailColors color =
          isFaceDown
              ? CardDetailUtil.DetailColors.FACE_DOWN
              : CardDetailUtil.getBorderColor(
                  card.getCurrentState(),
                  true); // otherwise doesn't work correctly for face down Morphs
      backColor = FSkinColor.fromRGB(color.r, color.g, color.b);
      foreColor = FSkinColor.getHighContrastColor(backColor);

      width -= CARD_WIDTH; // account for card picture
      width -=
          3 * PADDING
              + 2
                  * BORDER_THICKNESS; // account for left and right insets and gap between picture
                                      // and text
      float height = Math.max(CARD_HEIGHT, textRenderer.getWrappedBounds(text, FONT, width).height);
      height += 2 * (PADDING + BORDER_THICKNESS);
      preferredHeight = Math.round(height);
    }
Ejemplo n.º 2
0
  @Override
  protected void drawOnContainer(Graphics g) {
    // draw target arrows immediately above stack for active item only
    if (activeItem != null) {
      Vector2 arrowOrigin =
          new Vector2(
              activeItem.getLeft()
                  + VStack.CARD_WIDTH * FCardPanel.TARGET_ORIGIN_FACTOR_X
                  + VStack.PADDING
                  + VStack.BORDER_THICKNESS,
              activeItem.getTop()
                  + VStack.CARD_HEIGHT * FCardPanel.TARGET_ORIGIN_FACTOR_Y
                  + VStack.PADDING
                  + VStack.BORDER_THICKNESS);

      PlayerView activator = activeStackInstance.getActivatingPlayer();
      arrowOrigin = arrowOrigin.add(screenPos.x, screenPos.y);

      StackItemView instance = activeStackInstance;
      while (instance != null) {
        for (CardView c : instance.getTargetCards()) {
          TargetingOverlay.drawArrow(g, arrowOrigin, c, activator.isOpponentOf(c.getController()));
        }
        for (PlayerView p : instance.getTargetPlayers()) {
          TargetingOverlay.drawArrow(g, arrowOrigin, p, activator.isOpponentOf(p));
        }
        instance = instance.getSubInstance();
      }
    }
  }