com.badlogic.gdx.scenes.scene2d.actions.Actions Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.actions.Actions. 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: DeckBuilderScreen.java    From Cardshifter with Apache License 2.0 6 votes vote down vote up
@Override
public void zoomCard(final CardViewSmall cardView) {
	if (this.cardZoomedIn) {
		return;
	}
	final CardViewSmall cardViewCopy = new CardViewSmall(this.context, cardView.cardInfo, this, true);
	cardViewCopy.setTargetable(TargetStatus.TARGETABLE, this);
	cardViewCopy.getActor().setPosition(this.screenWidth/2.7f, this.screenHeight/30);
	this.game.stage.addActor(cardViewCopy.getActor());
	this.initialCardViewWidth = cardView.getActor().getWidth();
	this.initialCardViewHeight = cardView.getActor().getHeight();
	SequenceAction sequence = new SequenceAction();
	Runnable adjustForZoom = new Runnable() {
	    @Override
	    public void run() {
	    	cardViewCopy.zoom();
	    }
	};
	sequence.addAction(Actions.sizeTo(this.screenWidth/4, this.screenHeight*0.9f, 0.2f));
	sequence.addAction(Actions.run(adjustForZoom));		
	cardViewCopy.getActor().addAction(sequence);
	this.cardZoomedIn = true;
}
 
Example #3
Source File: PageView.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
public void nextView() {
    Gdx.app.debug("PageView", "Change to next view");
    SnapshotArray<Actor> children = this.getChildren();
    if (children.get(children.size - 1).getX() <= 0) {
        Gdx.app.debug("PageView", "Already last one, can't move to next.");
        return;
    }
    Actor[] actors = children.begin();
    float width = this.getWidth();
    for (Actor actor : actors) {
        if (actor != null) {
            actor.addAction(Actions.moveTo(actor.getX() - width, 0, 0.5f));
        }
    }
    children.end();
}
 
Example #4
Source File: VisDialog.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
/** 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();
}
 
Example #5
Source File: SimpleFormValidator.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private void updateWidgets () {
	for (Disableable disableable : disableTargets) {
		disableable.setDisabled(formInvalid);
	}

	if (messageLabel != null) {
		if (errorMsgText != null) {
			messageLabel.setText(errorMsgText);
		} else {
			messageLabel.setText(successMsg); //setText will default to "" if successMsg is null
		}

		Color targetColor = errorMsgText != null ? style.errorLabelColor : style.validLabelColor;
		if (targetColor != null && style.colorTransitionDuration != 0) {
			messageLabel.addAction(Actions.color(targetColor, style.colorTransitionDuration));
		} else {
			messageLabel.setColor(targetColor);
		}
	}
}
 
Example #6
Source File: CardViewSmall.java    From Cardshifter with Apache License 2.0 6 votes vote down vote up
public void dragStop (InputEvent event, float x, float y, int pointer) {
	if (CardViewSmall.this.callback != null) {
		if (CardViewSmall.this.callback instanceof DeckBuilderScreen) {
   			if (!((DeckBuilderScreen)callback).checkCardDrop(CardViewSmall.this)) {
   	    		table.addAction(Actions.moveTo(this.startX, this.startY, 0.2f));
   			}
		} else if (CardViewSmall.this.callback instanceof GameScreen) {
			if (!((GameScreen)callback).checkCardDrop(CardViewSmall.this)) {
				table.addAction(Actions.moveTo(this.startX, this.startY, 0.2f));
			} else {
				CardViewSmall.this.performAction();
			}
		}
	} else {
		table.addAction(Actions.moveTo(this.startX, this.startY, 0.2f));
	}
}
 
Example #7
Source File: BvBWorkspace.java    From talos with Apache License 2.0 6 votes vote down vote up
public void flyLabel (String text) {
    Label label = new Label(text, TalosMain.Instance().getSkin());
    label.setPosition(getWidth()/2f - label.getPrefWidth()/2f, 0);
    addActor(label);

    label.addAction(Actions.fadeOut(0.4f));

    label.addAction(Actions.sequence(
            Actions.moveBy(0, 100, 0.5f),
            Actions.run(new Runnable() {
                @Override
                public void run () {
                    label.remove();
                }
            })
    ));


}
 
Example #8
Source File: Hud.java    From Unlucky with MIT License 6 votes vote down vote up
private void backToMenu() {
    game.menuScreen.transitionIn = 0;
    if (gameScreen.gameMap.weather != WeatherType.NORMAL) {
        rm.lightrain.stop(gameScreen.gameMap.soundId);
        rm.heavyrain.stop(gameScreen.gameMap.soundId);
    }
    if (gameScreen.isClickable()) {
        gameScreen.setClickable(false);
        gameScreen.setBatchFade(false);
        // fade out animation
        stage.addAction(Actions.sequence(Actions.fadeOut(0.3f),
            Actions.run(new Runnable() {
                @Override
                public void run() {
                    gameScreen.setClickable(true);
                    gameScreen.gameMap.mapTheme.stop();
                    game.setScreen(game.menuScreen);
                }
            })));
    }
}
 
Example #9
Source File: Dialog.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
/** {@link #pack() Packs} the dialog and adds it to the stage, centered. */
public Dialog show (Stage stage) {
	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();
	setPosition(Math.round((stage.getWidth() - getWidth()) / 2), Math.round((stage.getHeight() - getHeight()) / 2));
	stage.addActor(this);
	stage.setKeyboardFocus(this);
	stage.setScrollFocus(this);
	if (fadeDuration > 0) {
		getColor().a = 0;
		addAction(Actions.fadeIn(fadeDuration, Interpolation.fade));
	}
	return this;
}
 
Example #10
Source File: Message.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
public static void showMsg(final Stage stage, final String text, final boolean modal) {

	// show in the next frame to allow calling when no OpenGL context is available.
	Timer.post(new Task() {

		@Override
		public void run() {
			isModal = modal;

			if (text == null) {
				hideMsg();
				return;
			}

			add(stage, text);

			if (FADE_DURATION > 0) {
				msg.getColor().a = 0;
				msg.addAction(Actions.fadeIn(FADE_DURATION, Interpolation.fade));
			}

		}
	});

}
 
Example #11
Source File: InventoryUI.java    From Unlucky with MIT License 6 votes vote down vote up
/**
 * Initializes the type of inventory (menu or in game) and the stage
 * Adds everything to the stage
 *
 * @param inMenu
 * @param s
 */
public void init(boolean inMenu, Stage s) {
    this.inMenu = inMenu;
    this.gameScreen = game.gameScreen;
    if (inMenu) this.stage = s;

    stage.addActor(ui);
    stage.addActor(exitButton);
    for (int i = 0; i < headers.length; i++) stage.addActor(headers[i]);
    for (int i = 0; i < stats.length; i++) stage.addActor(stats[i]);
    stage.addActor(selectedSlot);
    stage.addActor(tooltip);
    for (int i = 0; i < 2; i++) {
        stage.addActor(invButtons[i]);
        stage.addActor(invButtonLabels[i]);
    }

    if (!inMenu) {
        // reset the stage position after actions
        stage.addAction(Actions.moveTo(0, 0));
        Gdx.input.setInputProcessor(this.stage);
        renderHealthBars = true;
    }
}
 
Example #12
Source File: SelectScreen.java    From Unlucky with MIT License 6 votes vote down vote up
@Override
public void show() {
    game.fps.setPosition(5, 115);
    stage.addActor(game.fps);

    Gdx.input.setInputProcessor(stage);
    renderBatch = false;
    batchFade = true;

    // fade in animation
    stage.addAction(Actions.sequence(Actions.alpha(0), Actions.run(new Runnable() {
        @Override
        public void run() {
            renderBatch = true;
        }
    }), Actions.fadeIn(0.5f)));
}
 
Example #13
Source File: T.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
public T isButton(final TClickListener clickListener) {
    actor.setTouchable(Touchable.enabled);
    actor.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            actor.addAction(Actions.sequence(Actions.scaleTo(0.9f, 0.9f, 0.1f), Actions.scaleTo(1, 1, 0.1f), Actions.run(new Runnable() {
                @Override
                public void run() {
                    if (clickListener != null) {
                        clickListener.onClick(actor);
                    }
                }
            })));
        }
    });

    return this;
}
 
Example #14
Source File: InventoryScreen.java    From Unlucky with MIT License 6 votes vote down vote up
@Override
public void show() {
    game.fps.setPosition(2, 2);
    stage.addActor(game.fps);

    Gdx.input.setInputProcessor(stage);
    renderBatch = true;
    batchFade = true;

    stage.addAction(Actions.sequence(Actions.moveTo(-Unlucky.V_WIDTH, 0),
        Actions.moveTo(0, 0, 0.3f),
        Actions.run(new Runnable() {
            @Override
            public void run() {
                game.inventoryUI.renderHealthBars = true;
            }
        })));

    game.inventoryUI.init(true, this.stage);
    game.inventoryUI.start();
}
 
Example #15
Source File: AbstractScreen.java    From Unlucky with MIT License 6 votes vote down vote up
/**
 * Switches to a new screen while handling fading buffer
 * Fade transition
 *
 * @param screen
 */
public void setFadeScreen(final Screen screen) {
    if (clickable) {
        clickable = false;
        batchFade = false;
        // fade out animation
        stage.addAction(Actions.sequence(Actions.fadeOut(0.3f),
            Actions.run(new Runnable() {
                @Override
                public void run() {
                    clickable = true;
                    game.setScreen(screen);
                }
            })));
    }
}
 
Example #16
Source File: SpawnController.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
private void refreshStartButton() {
    startButton.setDisabled(placed.size == 0);
    startButton.clearActions();
    if (placed.size == 0) {
        startButton.addAction(Actions.moveTo(
                world.stage.getWidth() / 2 - startButton.getWidth() / 2,
                world.stage.getHeight() + startButton.getHeight(),
                0.5f,
                Interpolation.swingIn
        ));
    } else {
        startButton.addAction(Actions.moveTo(
                world.stage.getWidth() / 2 - startButton.getWidth() / 2,
                world.stage.getHeight() - startButton.getHeight() - 4,
                0.5f,
                Interpolation.swingOut
        ));
    }
}
 
Example #17
Source File: RandomTurnProcessor.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@Override public IFuture<TurnResponse> process(final TurnParams params) {
    final Future<TurnResponse> future = new Future<TurnResponse>();
    params.creature.world.stage.addAction(Actions.delay(
        ViewScroller.CENTER_ON_TIME,
        Actions.run(new Runnable() {
            @Override public void run() {
                Array<Ability> profAbilities = params.availableProfessionAbilities;
                RandomController r = params.creature.world.getController(RandomController.class);
                boolean move = profAbilities.size == 0 || r.randomBoolean();
                if (move) {
                    future.happen(new TurnResponse<Grid2D.Coordinate>(TurnResponse.TurnAction.MOVE, r.random(params.availableCells)));
                } else {
                    future.happen(new TurnResponse<Ability>(TurnResponse.TurnAction.PROFESSION_ABILITY, r.random(params.availableProfessionAbilities)));
                }
            }
        })
    ));
    return future;
}
 
Example #18
Source File: GameOverScreen.java    From Bomberman_libGdx with MIT License 6 votes vote down vote up
@Override
public void show() {
    viewport = new FitViewport(640, 480);
    stage = new Stage(viewport, batch);

    font = new BitmapFont(Gdx.files.internal("fonts/foo.fnt"));

    Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE);
    Label gameOverLabel = new Label("Game Over", labelStyle);
    gameOverLabel.setPosition((640 - gameOverLabel.getWidth()) / 2, 226f);

    GameManager.getInstance().playMusic("GameOver.ogg", false);

    stage.addActor(gameOverLabel);

    stage.addAction(Actions.sequence(
            Actions.delay(1f),
            Actions.fadeOut(2f),
            Actions.run(new Runnable() {
                @Override
                public void run() {
                    game.setScreen(new MainMenuScreen(game));
                }
            })));

}
 
Example #19
Source File: TImage.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
public TImage isButton() {
    clearListeners();
    origonCenter();
    addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            addAction(Actions.sequence(Actions.scaleTo(0.9f, 0.9f, 0.1f), Actions.scaleTo(1, 1, 0.1f), Actions.run(new Runnable() {
                @Override
                public void run() {
                    if (clickListener != null) {
                        clickListener.onClicked(TImage.this);
                    }
                }
            })));
        }
    });
    return this;
}
 
Example #20
Source File: PoisonDartVisualizer.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@Override public IFuture<Void> visualize(PoisonShotResult result) {
    final Future<Void> future = new Future<Void>();
    final WorldObjectView actorView = visualizer.viewController.getView(result.creature);
    WorldObjectView targetView = visualizer.viewController.getView(result.target);
    Vector2 direction = tmp.set(result.target.getX(), result.target.getY()).sub(result.creature.getX(), result.creature.getY());

    visualizer.viewController.scroller.centerOn(result.target);
    float dx = targetView.getX() - actorView.getX();
    float dy = targetView.getY() - actorView.getY();

    final ImageSubView arrow = new ImageSubView("animation/poison-dart");
    arrow.getActor().setOrigin(13, 14);
    arrow.getActor().setRotation(direction.angle());
    arrow.getActor().addAction(Actions.sequence(
        Actions.moveBy(dx, dy, tmp.set(dx, dy).len() * 0.003f),
        Actions.run(new Runnable() {
            @Override public void run() {
                SoundManager.instance.playSound("arrow-shot");
                actorView.removeSubView(arrow);
                future.happen();
            }
        })
    ));
    actorView.addSubView(arrow);
    return future;
}
 
Example #21
Source File: VisWindow.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
/**
 * Fade outs this window, when fade out animation is completed, window is removed from Stage. Calling this for the
 * second time won't have any effect if previous animation is still running.
 */
public void fadeOut (float time) {
	if (fadeOutActionRunning) return;
	fadeOutActionRunning = true;
	final Touchable previousTouchable = getTouchable();
	setTouchable(Touchable.disabled);
	Stage stage = getStage();
	if (stage != null && stage.getKeyboardFocus() != null && stage.getKeyboardFocus().isDescendantOf(this)) {
		FocusManager.resetFocus(stage);
	}
	addAction(Actions.sequence(Actions.fadeOut(time, Interpolation.fade), new Action() {
		@Override
		public boolean act (float delta) {
			setTouchable(previousTouchable);
			remove();
			getColor().a = 1f;
			fadeOutActionRunning = false;
			return true;
		}
	}));
}
 
Example #22
Source File: AbstractScreen.java    From Unlucky with MIT License 6 votes vote down vote up
/**
 * Switches to a new screen while handling fading buffer
 * Slide transition either to the left or right
 *
 * @param screen
 * @param right
 */
public void setSlideScreen(final Screen screen, boolean right) {
    if (clickable) {
        clickable = false;
        batchFade = true;
        // slide animation
        stage.addAction(Actions.sequence(
            Actions.moveBy(right ? -Unlucky.V_WIDTH : Unlucky.V_WIDTH, 0, 0.15f),
            Actions.run(new Runnable() {
                @Override
                public void run() {
                    clickable = true;
                    game.setScreen(screen);
                }
            })));
    }
}
 
Example #23
Source File: BossTurnProcessor.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<TurnResponse> process(final TurnParams params) {
    final Future<TurnResponse> future = new Future<TurnResponse>();
    params.creature.world.stage.addAction(Actions.delay(ViewScroller.CENTER_ON_TIME, Actions.run(new Runnable() {
        @Override public void run() {
            future.happen(new TurnResponse<Grid2D.Coordinate>(
                TurnResponse.TurnAction.MOVE,
                new Grid2D.Coordinate(params.creature.getX(), params.creature.getY())
            ));
        }
    })));
    return future;
}
 
Example #24
Source File: TransformFromObstacleVisualizer.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<Void> visualize(final TransformFromObstacleResult result) {
    final Future<Void> future = new Future<Void>();
    final WorldObjectView view = ViewController.createView(visualizer.viewController.world.viewer, visualizer.viewController.world.playerColors, result.creature);
    final WorldObjectView obstacle = result.obstacle.world.getController(ViewController.class).getView(result.obstacle);
    visualizer.viewController.scroller.centerOn(result.obstacle);
    visualizer.viewController.effectLayer.addActor(view);
    view.setOffsetY(2);
    view.setPosition(
        result.obstacle.getX() * ViewController.CELL_SIZE,
        result.obstacle.getY() * ViewController.CELL_SIZE
    );
    view.getColor().a = 0f;
    view.addAction(Actions.delay(0.4f, Actions.run(new Runnable() {
        @Override public void run() {
            if (result.ability.name.equals("potion-of-petrification")) {
                SoundManager.instance.playSound("ability-freeze-hit");
            } else {
                SoundManager.instance.playSound("transformation");
            }
        }
    })));
    view.addAction(Actions.alpha(1, 0.5f));
    obstacle.addAction(Actions.sequence(
        Actions.alpha(0, 0.5f),
        Actions.run(new Runnable() {
            @Override public void run() {
                view.remove();
                future.happen();
            }
        })
    ));
    return future;
}
 
Example #25
Source File: FileDragDropController.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
@Override
public void onDragStarted(int screenX, int screenY) {
    eventDispatcher.postEvent(new FileDragDropEvent(FileDragDropEvent.Action.START_DRAGGING));

    overlayRoot.clearActions();
    overlayRoot.addAction(Actions.sequence(
            Actions.scaleTo(1.5f, 1.5f),
            Actions.visible(true),
            Actions.parallel(
                    Actions.fadeIn(0.5f, Interpolation.pow5Out),
                    Actions.scaleTo(1f, 1f, 0.5f, Interpolation.pow5Out)
            )
    ));
}
 
Example #26
Source File: ResurrectLikeSummonVisualizer.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<Void> visualize(final SummonResult result) {
    final Future<Void> future = new Future<Void>();
    final ParticleActor particle = new ParticleActor(Config.particles.get("ability-summon-" + result.summoned.profession.name).obtain());
    particle.addListener(new ChangeListener() {
        @Override public void changed(ChangeEvent event, Actor actor) {
            particle.remove();
            particle.effect.free();
        }
    });
    particle.setPosition(
        ViewController.CELL_SIZE * result.coordinate.x() + ViewController.CELL_SIZE / 2f,
        ViewController.CELL_SIZE * result.coordinate.y() + PARTICLE_OFFSET
    );
    particle.addAction(Actions.moveBy(0, -PARTICLE_OFFSET + 5, 1f));
    visualizer.viewController.effectLayer.addActor(particle);
    result.summoned.setPosition(result.coordinate.x(), result.coordinate.y());
    WorldObjectView view = visualizer.viewController.addView(result.summoned);
    view.getColor().a = 0;
    SoundManager.instance.playMusicAsSound("ability-boss-summon");
    view.addAction(Actions.sequence(
        Actions.alpha(1f, 1f),
        Actions.run(new Runnable() {
            @Override public void run() {
                particle.effect.allowCompletion();
                visualizer.viewController.removeView(result.summoned);
                future.happen();
            }
        })
    ));
    return future;
}
 
Example #27
Source File: RandomCoordinateProcessor.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<Grid2D.Coordinate> process(final AbilityCoordinatesParams params) {
    final Future<Grid2D.Coordinate> future = new Future<Grid2D.Coordinate>();
    params.creature.world.stage.addAction(Actions.delay(
        ViewScroller.CENTER_ON_TIME,
        Actions.run(new Runnable() {
            @Override public void run() {
                future.happen(params.creature.world.getController(RandomController.class).random(params.coordinates));
            }
        })
    ));
    return future;
}
 
Example #28
Source File: RandomCreatureProcessor.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<Creature> process(final AbilityCreatureParams params) {
    final Future<Creature> future = new Future<Creature>();
    params.creature.world.stage.addAction(Actions.delay(
        ViewScroller.CENTER_ON_TIME,
        Actions.run(new Runnable() {
            @Override public void run() {
                future.happen(params.creature.world.getController(RandomController.class).random(params.available));
            }
        })
    ));
    return future;
}
 
Example #29
Source File: ShowTutorialMessage.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public void start(Callback callback) {
    Message message = resources.getIfExists("tutorialMessage");
    if (message != null) {
        new Tutorial(resources, Tutorial.tasks().with(new HideTutorialMessage())).start();
    }
    Stage stage = resources.get("stage");
    message = new Message(addTapToContinueText);
    stage.addActor(message);
    resources.put("tutorialMessage", message);
    if (message.getStage() != stage) {
        stage.addActor(message);
    }
    message.setTop(onTop);
    message.label.setKey(locKey);
    if (paramsProvider != null) {
        message.label.setParams(paramsProvider.apply(resources));
    }
    if (onTop) {
        message.setY(message.child.getPrefHeight());
    } else {
        message.setY(-message.child.getPrefHeight());
    }
    message.addAction(Actions.moveTo(
        0, 0, 0.3f
    ));
    callback.taskEnded();
}
 
Example #30
Source File: AiDefaultProfessionAbilityProcessor.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public IFuture<TurnResponse> process(TurnParams params) {
    final Future<TurnResponse> future = new Future<TurnResponse>();
    params.creature.world.stage.addAction(Actions.delay(ViewScroller.CENTER_ON_TIME, Actions.run(new Runnable() {
        @Override public void run() {
            future.happen(new TurnResponse<Ability>(TurnResponse.TurnAction.PROFESSION_ABILITY, ability));
        }
    })));
    return future;
}