Search in sources :

Example 1 with RunnableAction

use of com.badlogic.gdx.scenes.scene2d.actions.RunnableAction in project skin-composer by raeleus.

the class RootTable method display.

private void display(final String text) {
    SequenceAction sequenceAction = new SequenceAction();
    if (statusLabel.isVisible()) {
        statusLabel.clearActions();
        AlphaAction alphaAction = new AlphaAction();
        alphaAction.setAlpha(0.0f);
        alphaAction.setDuration(.25f);
        sequenceAction.addAction(alphaAction);
        RunnableAction runnableAction = new RunnableAction();
        runnableAction.setRunnable(() -> {
            statusLabel.setText(text);
        });
        sequenceAction.addAction(runnableAction);
        alphaAction = new AlphaAction();
        alphaAction.setAlpha(1.0f);
        alphaAction.setDuration(.25f);
        sequenceAction.addAction(alphaAction);
        DelayAction delayAction = new DelayAction();
        delayAction.setDuration(3.0f);
        sequenceAction.addAction(delayAction);
        alphaAction = new AlphaAction();
        alphaAction.setAlpha(0.0f);
        alphaAction.setDuration(1.5f);
        sequenceAction.addAction(alphaAction);
        VisibleAction visibleAction = new VisibleAction();
        visibleAction.setVisible(false);
        sequenceAction.addAction(visibleAction);
    } else {
        statusLabel.setText(text);
        statusLabel.clearActions();
        statusLabel.setVisible(true);
        AlphaAction alphaAction = new AlphaAction();
        alphaAction.setAlpha(1.0f);
        alphaAction.setDuration(.5f);
        sequenceAction.addAction(alphaAction);
        DelayAction delayAction = new DelayAction();
        delayAction.setDuration(3.0f);
        sequenceAction.addAction(delayAction);
        alphaAction = new AlphaAction();
        alphaAction.setAlpha(0.0f);
        alphaAction.setDuration(1.5f);
        sequenceAction.addAction(alphaAction);
        VisibleAction visibleAction = new VisibleAction();
        visibleAction.setVisible(false);
        sequenceAction.addAction(visibleAction);
    }
    statusLabel.addAction(sequenceAction);
}
Also used : RunnableAction(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction) DelayAction(com.badlogic.gdx.scenes.scene2d.actions.DelayAction) AlphaAction(com.badlogic.gdx.scenes.scene2d.actions.AlphaAction) SequenceAction(com.badlogic.gdx.scenes.scene2d.actions.SequenceAction) VisibleAction(com.badlogic.gdx.scenes.scene2d.actions.VisibleAction)

Example 2 with RunnableAction

use of com.badlogic.gdx.scenes.scene2d.actions.RunnableAction in project skin-composer by raeleus.

the class DialogLoading method show.

@Override
public Dialog show(Stage stage) {
    Dialog dialog = super.show(stage);
    RunnableAction runnableAction = new RunnableAction();
    runnableAction.setRunnable(() -> {
        if (runnable != null) {
            runnable.run();
        }
        hide();
    });
    Action action = new SequenceAction(new DelayAction(.5f), runnableAction);
    addAction(action);
    return dialog;
}
Also used : RunnableAction(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction) SequenceAction(com.badlogic.gdx.scenes.scene2d.actions.SequenceAction) Action(com.badlogic.gdx.scenes.scene2d.Action) DelayAction(com.badlogic.gdx.scenes.scene2d.actions.DelayAction) Dialog(com.badlogic.gdx.scenes.scene2d.ui.Dialog) RunnableAction(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction) DelayAction(com.badlogic.gdx.scenes.scene2d.actions.DelayAction) SequenceAction(com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)

Example 3 with RunnableAction

use of com.badlogic.gdx.scenes.scene2d.actions.RunnableAction in project var3dframe by Var3D.

the class ActorAnimation method addEndHiddenActions.

/**
 * 增加播放完成后隐藏的Actions
 * <p>
 * frequency播放几遍后隐藏
 */
public void addEndHiddenActions(int frequency) {
    RunnableAction end = Actions.run(new Runnable() {

        public void run() {
            ActorAnimation.this.setVisible(false);
        }
    });
    setRunnableAction(frequency, end);
}
Also used : RunnableAction(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction)

Example 4 with RunnableAction

use of com.badlogic.gdx.scenes.scene2d.actions.RunnableAction in project var3dframe by Var3D.

the class ActorAnimation method addEndRemoveActions.

/**
 * 增加播放完成后移除的Actions
 * <p>
 * frequency播放几遍后隐藏
 */
public void addEndRemoveActions(int frequency) {
    RunnableAction end = Actions.run(new Runnable() {

        public void run() {
            ActorAnimation.this.remove();
        }
    });
    setRunnableAction(frequency, end);
}
Also used : RunnableAction(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction)

Aggregations

RunnableAction (com.badlogic.gdx.scenes.scene2d.actions.RunnableAction)4 DelayAction (com.badlogic.gdx.scenes.scene2d.actions.DelayAction)2 SequenceAction (com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)2 Action (com.badlogic.gdx.scenes.scene2d.Action)1 AlphaAction (com.badlogic.gdx.scenes.scene2d.actions.AlphaAction)1 VisibleAction (com.badlogic.gdx.scenes.scene2d.actions.VisibleAction)1 Dialog (com.badlogic.gdx.scenes.scene2d.ui.Dialog)1