Beispiel #1
0
 /** unzooms the currently zoomed card */
 private void unzoom() {
   stopMakingSpace();
   zoomCard.setTouchable(Touchable.enabled);
   zoomCard.addAction(Actions.scaleTo(1.0f, 1.0f, 0.2f, Interpolation.pow2));
   addCard(zoomCard, zoomReturnIndex);
   zoomCard = null;
   for (Actor actor : getChildren()) {
     actor.setTouchable(Touchable.enabled);
   }
   for (Actor actor : cards.getChildren()) {
     actor.setTouchable(Touchable.enabled);
   }
   zoomGroup.setTouchable(Touchable.disabled);
   zoomGroup.setVisible(false);
 }
Beispiel #2
0
  public void addWidget(Actor actor, Color color) {
    actor.setTouchable(Touchable.disabled);

    if (actor instanceof Table) {
      ((Table) actor).setTransform(true);
    }
    widgets.add(actor);
    colors.add(color);

    if (getActor() == null) {
      setActor(actor);
      setColor(color == null ? style.color : color);
      toShow = actor;
      actor.setTouchable(Touchable.enabled);
    }
  }
Beispiel #3
0
 public void dungeonEndedClient() {
   for (Actor actor : panels.getChildren()) {
     actor.setTouchable(Touchable.disabled);
     actor.addAction(Actions.fadeOut(1));
     actor.addAction(
         Actions.delay(
             1,
             Actions.run(
                 new Runnable() {
                   @Override
                   public void run() {
                     panels.clear();
                   }
                 })));
   }
 }
Beispiel #4
0
  public void setSelectedWidget(int index) {
    if (widgets.size > index) {
      Actor newBar = widgets.get(index);

      if (newBar != toShow) {
        Color color = colors.get(index);
        setColor(color == null ? style.color : color);

        for (Actor widget : widgets) {
          widget.clearActions();
        }

        Actor current = getActor();
        if (current != null) {
          current.setTouchable(Touchable.disabled);
        } else {
          current = toShow;
        }

        toShow = newBar;

        Actor toHide = current;
        toHide.setOrigin(Align.center);

        if (toShow.getScaleY() == 1) {
          toShow.setScaleY(0);
          toShow.setOriginY(toHide.getOriginY());
          toShow.getColor().a = 0;
        }

        float timeHide = ANIM_TIME * Math.abs(toHide.getScaleY());

        Action actionShow = Actions.run(actionAddActor);
        Action actionHide =
            Actions.parallel(
                Actions.scaleTo(1, 0, timeHide, Interpolation.sineOut), Actions.fadeOut(timeHide));

        if (newBar == current) {
          toHide.addAction(actionShow);
        } else {
          toHide.addAction(Actions.sequence(actionHide, actionShow));
        }
      }
    }
  }
Beispiel #5
0
  /**
   * brings the card up to the front and center, leaving a space where it belongs in the hand.
   * Nothing other than the card and its controls can be clicked during a zoom. Tapping the card
   * unzooms it. There also is a cancel, play, and rotate button, and arrows to see the next and
   * previous cards in the hand.
   *
   * @param toAdd card to zoom in on
   */
  private void zoomCard(CardGroup toAdd) {
    zoomCard = toAdd;
    // remove toAdd from the hand and add it to the root
    zoomReturnIndex = cards.getChildren().indexOf(toAdd, true);
    zoomCard.remove();
    addActor(zoomCard);
    makeSpace(zoomReturnIndex);

    zoomCard.getActions().clear();
    // blow the card up
    zoomCard.addAction(Actions.scaleTo(3.0f, 3.0f, 0.2f, Interpolation.pow2));
    // move it
    zoomCard.addAction(Actions.moveTo(600, 100, 0.2f, Interpolation.pow2));

    // make only the zoom elements touchable
    for (Actor actor : getChildren()) {
      actor.setTouchable(Touchable.disabled);
    }
    zoomGroup.setTouchable(Touchable.enabled);
    zoomGroup.setVisible(true);
    updateZoomControls();
  }