本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.actions.ParallelAction类的典型用法代码示例。如果您正苦于以下问题:Java ParallelAction类的具体用法?Java ParallelAction怎么用?Java ParallelAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParallelAction类属于com.badlogic.gdx.scenes.scene2d.actions包,在下文中一共展示了ParallelAction类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldParseSpriteView
import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction; //导入依赖的package包/类
@Test
@NeedGL
public void shouldParseSpriteView() throws Exception {
CocoStudioUIEditor editor = new CocoStudioUIEditor(
Gdx.files.internal("animation/MainScene.json"), null, null, null, null);
Group group = editor.createGroup();
Image image = group.findActor("st_2");
Array<Action> actions = image.getActions();
assertThat(actions.size, is(1));
RepeatAction repeatAction = (RepeatAction) actions.get(0);
ParallelAction parallelAction = (ParallelAction) repeatAction.getAction();
assertThat(parallelAction.getActions().size, is(3));
assertThat(parallelAction.getActions(), (Matcher) everyItem(instanceOf(SequenceAction.class)));
SequenceAction moveAction = (SequenceAction) parallelAction.getActions().get(0);
SequenceAction scaleAction = (SequenceAction) parallelAction.getActions().get(1);
assertThat(moveAction.getActions().size, is(4));
assertThat(moveAction.getActions(), (Matcher) everyItem(instanceOf(MoveToAction.class)));
assertThat(scaleAction.getActions().size, is(4));
assertThat(scaleAction.getActions(), (Matcher) everyItem(instanceOf(ScaleToAction.class)));
}
示例2: displayContextMenu
import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction; //导入依赖的package包/类
public void displayContextMenu(Table content, boolean lock, ButtonKeyboardHelper keyboardHelper)
{
if (lockContextMenu)
{
return;
}
lockContextMenu = lock;
if ( !created )
{
create();
created = true;
}
contextMenu = new Tooltip( content, skin, stage );
contextMenu.setWidth( stage.getWidth() - ( abilityPanel.getWidth() + equipmentPanel.getWidth() + 40 ) );
contextMenu.setHeight( stage.getHeight() - ( buttonsPanel.getHeight() + 40 ) );
contextMenu.show( stage.getWidth() / 2 - contextMenu.getWidth() / 2 - 10, stage.getHeight() / 2 - contextMenu.getHeight() / 2 - 30, lock );
ParallelAction parallelAction = new ParallelAction(
new SequenceAction( Actions.alpha( 0 ), Actions.fadeIn( 0.25f ) ),
new SequenceAction( Actions.scaleTo( 0, 0 ), Actions.scaleTo( 1, 1, 0.25f ) ) );
contextMenu.addAction( new SequenceAction( parallelAction, Actions.removeAction( parallelAction ) ) );
this.keyboardHelper = keyboardHelper;
}
示例3: render
import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction; //导入依赖的package包/类
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
escenario.draw();
escenario.act();
if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) {
ParallelAction par = new ParallelAction();
par.addAction(Actions.moveTo(250, 250, 1));
par.addAction(Actions.color(Color.BLUE, 1));
coche.addAction(par);
}
}
示例4: MainMenu
import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction; //导入依赖的package包/类
/**
* Konstruktor.
*/
public MainMenu() {
float moveToDuration = width / 5 / 30;
initStage(this.getViewport(), this.getSpriteBatch());
initTable(); // Table = Gridlayout
addBackground();
initButtons(); // To be called after initTable (adds itself to table)
setupEventListeners();
stage.addActor(table);
player = new PlayerImpl();
player.setPosition(0, 0.13f * height);
// player.scaleBy(0.5F);
player.setAnimationSpeed(0.4f);
stage.addActor(player);
ParallelAction toRight = Actions.parallel(Actions.moveTo(width + 50, player.getY(), moveToDuration),
new AnimationAction(Direction.RIGHT, moveToDuration));
ParallelAction toLeft = Actions.parallel(
Actions.moveTo(-100 - player.getWidth(), player.getY(), moveToDuration), new AnimationAction(
Direction.LEFT, moveToDuration));
player.addAction(Actions.forever(Actions.sequence(toRight, toLeft)));
AssetManager.loadMusic("mainMenu");
AssetManager.loadSounds("worldmap");
music = audioManager.getMusic("mainMenu", "belotti.mp3");
if (!music.isPlaying()) {
music.setLooping(true);
music.play();
}
}
示例5: fit
import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction; //导入依赖的package包/类
/**
* Sets the root group in its initial position, fitting the view
*/
public void fit(boolean animated) {
if (animated) {
sceneContainer.addAction(new SequenceAction(new ParallelAction(
Actions.moveTo(0, 0, TIME, Interpolation.exp5Out), Actions
.scaleTo(fitZoom, fitZoom, TIME,
Interpolation.exp5Out)), Actions
.run(containerUpdated)));
} else {
sceneContainer.setPosition(0.0f, 0.0f);
sceneContainer.setScale(fitZoom, fitZoom);
fireContainerUpdated();
}
}