Beispiel #1
0
  @Override
  public void act(float delta) {
    // TODO 自動生成されたメソッド・スタブ
    if (obj.remove) remove();

    if (objDraw && !obj.draw) {
      addAction(
          sequence(
              fadeOut(.3f),
              run(
                  new Runnable() {

                    @Override
                    public void run() {
                      // TODO 自動生成されたメソッド・スタブ
                      objDraw = false;
                    }
                  })));
    }

    if (!objDraw && obj.draw) {
      objDraw = true;
      addAction(fadeIn(.3f));
    }
    super.act(delta);
  }
 public SelectList(float x, float y) {
   setBounds(x, 0, SelectBox.this.getWidth(), 100);
   this.oldScreenCoords.set(screenCoords);
   layout();
   Stage stage = SelectBox.this.getStage();
   float height = getHeight();
   if (y - height < 0
       && y + SelectBox.this.getHeight() + height < stage.getCamera().viewportHeight)
     setY(y + SelectBox.this.getHeight());
   else setY(y - height);
   stage.addCaptureListener(stageListener);
   getColor().a = 0;
   addAction(fadeIn(0.3f, Interpolation.fade));
 }
Beispiel #3
0
  /**
   * {@link #pack() Packs} the dialog and adds it to the stage with custom action which can be null
   * for instant show
   */
  public Dialog show(Stage stage, Action action) {
    clearActions();
    removeCaptureListener(ignoreTouchDown);

    previousKeyboardFocus = null;
    Actor actor = stage.getKeyboardFocus();
    if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor;

    previousScrollFocus = null;
    actor = stage.getScrollFocus();
    if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;

    pack();
    stage.addActor(this);
    stage.setKeyboardFocus(this);
    stage.setScrollFocus(this);
    if (action != null) addAction(action);

    return this;
  }
Beispiel #4
0
  /** Hides the dialog with the given action and then removes it from the stage. */
  public void hide(Action action) {
    Stage stage = getStage();
    if (stage != null) {
      removeListener(focusListener);
      if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null)
        previousKeyboardFocus = null;
      Actor actor = stage.getKeyboardFocus();
      if (actor == null || actor.isDescendantOf(this))
        stage.setKeyboardFocus(previousKeyboardFocus);

      if (previousScrollFocus != null && previousScrollFocus.getStage() == null)
        previousScrollFocus = null;
      actor = stage.getScrollFocus();
      if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
    }
    if (action != null) {
      addCaptureListener(ignoreTouchDown);
      addAction(
          sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
    } else remove();
  }