Java Code Examples for com.badlogic.gdx.scenes.scene2d.Group#addAction()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.Group#addAction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DropVisualizer.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@Override public IFuture<Void> visualize(DroppedItem drop) {
    final Future<Void> future = new Future<Void>();

    Group group = new Group();
    Tile image = new Tile("item/" + drop.item.name);
    Label counter = new Label(String.valueOf(drop.count), Config.skin);
    counter.setSize(image.getWidth(), image.getHeight());
    counter.setAlignment(Align.right | Align.bottom);
    group.addActor(image);
    group.addActor(counter);
    group.setTransform(false);
    visualizer.viewController.notificationLayer.addActor(group);
    group.setPosition(drop.target.getX() * ViewController.CELL_SIZE, drop.target.getY() * ViewController.CELL_SIZE);
    group.addAction(Actions.parallel(
        Actions.moveBy(0, 30, 1f, Interpolation.fade),
        Actions.alpha(0, 1f, Interpolation.fade),
        Actions.delay(0.4f, Actions.run(new Runnable() {
            @Override public void run() {
                future.happen();
            }
        }))
    ));
    return future;
}
 
Example 2
Source File: StepDetectorSubView.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public void onChangedState(Boolean active) {
    Group appearing = active ? onGroup : offGroup;
    Group disappearing = active ? offGroup : onGroup;
    appearing.clearActions();
    appearing.addAction(alpha(1, 0.5f));
    disappearing.clearActions();
    disappearing.addAction(alpha(0, 0.5f));
    if (active) {
        SoundManager.instance.playMusicAsSound("step-detector-activation");
    }
}
 
Example 3
Source File: PvpUserWrapper.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override public IFuture<Response> process(final Params params) {
    final Future<Response> future = new Future<Response>();
    Stage stage = ((DiceHeroes) Gdx.app.getApplicationListener()).getState().stage;
    Tile icon = new Tile("ui/pvp/timer");
    icon.setPosition(ICON_PADDING, ICON_PADDING);

    Tile progress = new Tile("ui-reward-window-background");
    progress.setTouchable(Touchable.disabled);
    progress.setPosition(
        ICON_PADDING * 2 + icon.getWidth(),
        ICON_PADDING + icon.getHeight() * 0.5f - BAR_HEIGHT * 0.5f
    );
    progress.setSize(
        stage.getWidth() - ICON_PADDING * 3 - icon.getWidth(),
        BAR_HEIGHT
    );
    root = new Group();
    root.addActor(progress);
    root.addActor(icon);

    stage.addActor(root);
    root.addAction(delay(25, forever(sequence(
        visible(false),
        delay(0.1f),
        visible(true),
        delay(0.4f)
    ))));
    progress.addAction(
        sequence(
            sizeTo(0, BAR_HEIGHT, 30f),
            run(new Runnable() {
                @Override public void run() {
                    root.remove();
                    skip(future, params);
                }
            })
        )
    );
    processor.process(params).addListener(future);
    return future.addListener(this);
}