Esempio n. 1
0
  public void updateProperties() {
    if (editActors == null) return;

    updateProperties = true;

    Actor model = editActors.get(0);
    getStage().setKeyboardFocus(null);
    name.setText(model.getName());
    visible.setChecked(model.isVisible());
    positionX.setText(String.format(Locale.ENGLISH, "%.2f", model.getX()));
    positionY.setText(String.format(Locale.ENGLISH, "%.2f", model.getY()));
    rotation.setText(String.format(Locale.ENGLISH, "%.2f", model.getRotation()));
    lockRatio.setChecked(Math.abs(model.getScaleX() - model.getScaleY()) < 0.01f);
    scaleX.setText(String.format(Locale.ENGLISH, "%.2f", model.getScaleX()));
    scaleY.setText(String.format(Locale.ENGLISH, "%.2f", model.getScaleY()));
    Color color = model.getColor();
    r.setText(String.format(Locale.ENGLISH, "%.0f", color.r * 255));
    g.setText(String.format(Locale.ENGLISH, "%.0f", color.g * 255));
    b.setText(String.format(Locale.ENGLISH, "%.0f", color.b * 255));
    a.setText(String.format(Locale.ENGLISH, "%.0f", color.a * 255));

    scaleY.setDisabled(lockRatio.isChecked());
    scaleY.setColor(lockRatio.isChecked() ? disableColor : enableColor);

    updateProperties = false;
  }
 private Actor setupLastElement() {
   final int nextElement = (currentElement - 1 + getChildren().size) % getChildren().size;
   final Actor next = getChildren().get(nextElement);
   if (!next.isVisible()) {
     next.getColor().a = 0;
     next.setVisible(true);
     next.setPosition(-animationXOffset, 0);
     next.clearActions();
   }
   return next;
 }
Esempio n. 3
0
    @Override
    public void clicked(InputEvent event, float x, float y) {
      boolean playPopSound = true;
      Actor actor = event.getListenerActor();
      String name = actor.getName();

      if (name.compareTo(SettingsView.CHECKBOX_VIBRATION) == 0) {
        getSettings().handleVibrationClick(((MyButton) actor).isChecked());
      } else if (name.compareTo(SettingsView.CHECKBOX_CHAT) == 0) {
        getSettings().handleChatClick(((MyButton) actor).isChecked());
      } else if (name.compareTo(SettingsView.CHECKBOX_DEBUG) == 0) {
        getSettings().handleDebugClick(((MyButton) actor).isChecked());
      } else if (name.startsWith(SettingsView.LANGUAGE_PREFIX)) {
        getSettings().handleLanguageClick(name);
      } else if (name.startsWith(SettingsView.CARD_COLOR_PREFIX)) {
        if (actor.getColor().equals(getSettings().getCardColor()))
          ((MyButton) actor).setChecked(true);
        else getSettings().handleCardColorClick(actor.getColor());
      } else {
        playPopSound = false;
      }

      if (playPopSound) getSounds().playPopSound();
    }
Esempio n. 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));
        }
      }
    }
  }
Esempio n. 5
0
  /** Draws selection, icons, and expand icons. */
  private void draw(SpriteBatch batch, Array<Node> nodes, float indent) {
    Drawable plus = style.plus, minus = style.minus;
    float x = getX(), y = getY();
    for (int i = 0, n = nodes.size; i < n; i++) {
      Node node = nodes.get(i);
      Actor actor = node.actor;

      if (selectedNodes.contains(node, true) && style.selection != null) {
        style.selection.draw(
            batch, x, y + actor.getY() - ySpacing / 2, getWidth(), node.height + ySpacing);
      } else if (node == overNode && style.over != null) {
        style.over.draw(
            batch, x, y + actor.getY() - ySpacing / 2, getWidth(), node.height + ySpacing);
      }

      if (node.icon != null) {
        float iconY = actor.getY() + Math.round((node.height - node.icon.getMinHeight()) / 2);
        batch.setColor(actor.getColor());
        node.icon.draw(
            batch,
            x + node.actor.getX() - iconSpacing - node.icon.getMinWidth(),
            y + iconY,
            node.icon.getMinWidth(),
            node.icon.getMinHeight());
        batch.setColor(Color.WHITE);
      }

      if (node.children.size == 0) continue;

      Drawable expandIcon = node.expanded ? minus : plus;
      float iconY = actor.getY() + Math.round((node.height - expandIcon.getMinHeight()) / 2);
      expandIcon.draw(
          batch,
          x + indent - iconSpacing,
          y + iconY,
          expandIcon.getMinWidth(),
          expandIcon.getMinHeight());
      if (node.expanded) draw(batch, node.children, indent + indentSpacing);
    }
  }