本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.actions.SequenceAction类的典型用法代码示例。如果您正苦于以下问题:Java SequenceAction类的具体用法?Java SequenceAction怎么用?Java SequenceAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SequenceAction类属于com.badlogic.gdx.scenes.scene2d.actions包,在下文中一共展示了SequenceAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldParseSpriteView
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的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: addBackgroundExtension
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
private void addBackgroundExtension() {
Image stobottom = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.imageArrowBottom)));
stobottom.setSize(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getWidth() * 0.22f);
stobottom.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f);
Image selectroomtext = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.txtSelectExtension)));
selectroomtext.setSize(Gdx.graphics.getWidth() * 0.44f, Gdx.graphics.getHeight() * 0.12f);
selectroomtext.setPosition(Gdx.graphics.getWidth() / 2 - selectroomtext.getWidth() / 2, Gdx.graphics.getHeight() * 0.815f);
RepeatAction repeatActioan = new RepeatAction();
MoveToAction fadedown = new MoveToAction();
fadedown.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.71f);
fadedown.setDuration(0.5f);
MoveToAction fadeup = new MoveToAction();
fadeup.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f);
fadeup.setDuration(1f);
repeatActioan.setAction(new SequenceAction(fadedown, fadeup));
repeatActioan.setCount(RepeatAction.FOREVER);
stobottom.addAction(repeatActioan);
groupBtn = new Group();
groupBtn.addActor(stobottom);
groupBtn.addActor(selectroomtext);
}
示例3: setUpSkinImages
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public void setUpSkinImages() {
skinImage = new Image(skins.get(position).getTextureRegion());
skinImageRotation = new Image(skins.get(position).getTextureRegion());
skinImage.setSize(3f, 3f);
skinImage.setOrigin(skinImage.getWidth() / 2, skinImage.getHeight() / 2);
skinImage.setPosition(Constants.WIDTH / 3 - skinImage.getWidth() / 2, Constants.HEIGHT / 2);
skinImageRotation.setSize(3f, 3f);
skinImageRotation.setOrigin(skinImageRotation.getWidth() / 2, skinImageRotation.getHeight() / 2);
skinImageRotation.setPosition(Constants.WIDTH * 2 / 3 - skinImageRotation.getWidth() / 2, Constants.HEIGHT / 2);
SequenceAction rotateAction = new SequenceAction();
rotateAction.addAction(Actions.rotateBy(360, 0.5f, Interpolation.linear));
RepeatAction infiniteLoop = new RepeatAction();
infiniteLoop.setCount(RepeatAction.FOREVER);
infiniteLoop.setAction(rotateAction);
skinImageRotation.addAction(infiniteLoop);
stage.addActor(skinImageRotation);
stage.addActor(skinImage);
}
示例4: refreshStyleProperties
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public void refreshStyleProperties(boolean preserveScroll) {
if (stylePropertiesTable != null && stylePropertiesScrollPane != null) {
float scrollY;
if (preserveScroll) {
scrollY = stylePropertiesScrollPane.getScrollY();
} else {
scrollY = 0;
}
stylePropertiesTable.clearChildren();
addStyleProperties(stylePropertiesTable);
if (preserveScroll) {
validate();
stylePropertiesScrollPane.setSmoothScrolling(false);
stylePropertiesScrollPane.setScrollY(scrollY);
stylePropertiesScrollPane.addAction(new SequenceAction(new DelayAction(.1f), new Action() {
@Override
public boolean act(float delta) {
stylePropertiesScrollPane.setSmoothScrolling(true);
return true;
}
}));
}
}
}
示例5: handle
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public void handle(TmxMap tileMap, TmxCell collidingCell, Stage stage) {
AbstractBlock block = tileMap.getBlockAt(collidingCell.getX(), collidingCell.getY());
if (block!=null) {
if (block.getBlocType()==BlockTypeEnum.MYSTERY_BLOCK_INVISIBLE) {
block.changeFrame();
}
float yWallBlock = block.getY();
SequenceAction sequenceAction = new SequenceAction(
new ChangeCellValueAction(tileMap, (int)block.getX(), (int)yWallBlock, TileIdConstants.INVISIBLE_BLOCK),
ActionFacade.createMoveAction(block.getX(), yWallBlock + 0.4f, 0.08f),
ActionFacade.createMoveAction(block.getX(), yWallBlock, 0.08f),
new ReplaceWallAction(tileMap, block));
block.addAction(sequenceAction);
// Add item
addItemFromBlock(tileMap, stage, block);
// Check if one or several items were over the wall
bumpElements(tileMap, collidingCell, stage);
} else {
Gdx.app.log("ERROR", "Block already taken in account");
}
}
示例6: move
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public void move(int x, int y) {
float size = 32.0f;
// Distance in pixels
float dx = size * x;
float dy = size * y;
int destX = getPosX() + x;
int destY = getPosY() + y;
MoveByAction moveX = new MoveByAction();
moveX.setAmountX(dx);
moveX.setDuration(Math.abs(x) * 0.1f);
MoveByAction moveY = new MoveByAction();
moveY.setAmountY(dy);
moveY.setDuration(Math.abs(y) * 0.1f);
moveSeq = new SequenceAction(moveX, moveY);
Speech.getInstance().speak("move " + this.name + " to " + getLetter(destY) + " " + (destX + 1));
this.setPosition(destY, destX);
this.addAction(moveSeq);
moved = true;
GameState.getInstance().addMove();
}
示例7: zoomCard
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
@Override
public void zoomCard(final CardViewSmall cardView) {
if (this.cardZoomedIn) {
return;
}
final CardViewSmall cardViewCopy = new CardViewSmall(this.context, cardView.cardInfo, this, true);
cardViewCopy.getActor().setPosition(Gdx.graphics.getWidth()/2.7f, Gdx.graphics.getHeight()/30);
this.context.getStage().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(Gdx.graphics.getWidth()/4, Gdx.graphics.getHeight()*0.9f, 0.2f));
sequence.addAction(Actions.run(adjustForZoom));
cardViewCopy.getActor().addAction(sequence);
this.cardZoomedIn = true;
}
示例8: zoomCard
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
@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;
}
示例9: createActions
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
private void createActions() {
SequenceAction troopSequence = new SequenceAction();
SequenceAction labelSequence = new SequenceAction();
Vector2 centered = centered(path.get(0));
setPosition(centered.x, centered.y);
label.setPosition(centered.x, centered.y);
for (int i = 0; i < path.getCount() - 1; i++) {
Tile next = path.get(i + 1);
centered = centered(next);
troopSequence.addAction(Actions.rotateTo(angleToNext(i)));
troopSequence.addAction(Actions.moveTo(centered.x, centered.y, speed(path.get(i), next), Interpolation.linear));
labelSequence.addAction(Actions.moveTo(centered.x, centered.y, speed(path.get(i), next), Interpolation.linear));
}
troopSequence.addAction(Actions.run(() -> {
Tile last = path.get(path.getCount() - 1);
if (last.getOwner() == path.get(0).getOwner()) {
last.adjustTroops(troops);
Match.client.send(last);
} else {
new Battle(last, path.get(path.getCount() - 2), this);
}
}));
troopSequence.addAction(Actions.removeActor());
labelSequence.addAction(Actions.removeActor());
addAction(troopSequence);
label.addAction(labelSequence);
}
示例10: act
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
@Override
public void act(float delta) {
super.act(delta);
table.act(delta);
switch (state) {
case 0:
if(!Gdx.input.isTouched())
state++;
break;
case 1:
if(Gdx.input.isTouched())
state++;
break;
case 2:
if(!Gdx.input.isTouched()) {
AlphaAction action = new AlphaAction();
action.setAlpha(0f);
action.setDuration(0.3f);
addAction(new SequenceAction(action, new RunnableAction() {
@Override
public void run() {
remove();
}
}));
state++;
}
break;
}
}
示例11: createPuls
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public Group createPuls(float x, float y){
grPuls = new Group();
Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial);
Image image = new Image(new TextureRegion(txt));
Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
image.setSize(crop.x * 0.135f, crop.y * 0.135f);
image.setPosition(x, y);
grPuls.addActor(image);
txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable);
Image puls = new Image(new TextureRegion(txt));
crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
puls.setSize(1, 1);
MoveToAction move = new MoveToAction();
move.setDuration(1);
move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f);
MoveToAction mo = new MoveToAction();
mo.setDuration(0);
mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
ScaleToAction scale = new ScaleToAction();
scale.setScale(WIDTH*0.17f);
scale.setDuration(1);
ScaleToAction sc = new ScaleToAction();
sc.setDuration(0);
sc.setScale(0);
RepeatAction repeat = new RepeatAction();
repeat.setCount(RepeatAction.FOREVER);
repeat.setAction(new SequenceAction(scale, sc));
puls.addAction(repeat);
RepeatAction r = new RepeatAction();
r.setCount(RepeatAction.FOREVER);
r.setAction(new SequenceAction(move, mo));
puls.addAction(r);
grPuls.addActor(puls);
return grPuls;
}
示例12: ScreenLoading
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public ScreenLoading(GameManager game) {
gameManager = game;
assets = ManagerAssets.getInstance();
MoveToAction mred = new MoveToAction();
mred.setPosition(Width , -Height);
mred.setDuration(2f);
MoveToAction mred1 = new MoveToAction();
mred1.setPosition(-Width , Height);
mred1.setDuration(0);
translatered = new RepeatAction();
translatered.setCount(RepeatAction.FOREVER);
translatered.setAction(new SequenceAction(new DelayAction(0.0f), mred,mred1, new DelayAction(4.0f)));
MoveToAction mgreen = new MoveToAction();
mgreen.setPosition(Width , -Height );
mgreen.setDuration(2f);
MoveToAction mgreen1 = new MoveToAction();
mgreen1.setPosition(-Width , Height);
mgreen1.setDuration(0);
translategreen = new RepeatAction();
translategreen.setCount(RepeatAction.FOREVER);
translategreen.setAction(new SequenceAction(new DelayAction(2.0f), mgreen,mgreen1, new DelayAction(4.0f)));
MoveToAction mblue = new MoveToAction();
mblue.setPosition(Width , -Height);
mblue.setDuration(2f);
MoveToAction mblue1 = new MoveToAction();
mblue1.setPosition(-Width , Height);
mblue1.setDuration(0);
translateblue = new RepeatAction();
translateblue.setCount(RepeatAction.FOREVER);
translateblue.setAction(new SequenceAction(new DelayAction(4.0f), mblue,mblue1,new DelayAction(4.0f)));
}
示例13: spinnerRotateAction
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
private void spinnerRotateAction() {
SequenceAction rotateAction = new SequenceAction();
rotateAction.addAction(Actions.rotateBy(360, 0.5f, Interpolation.linear));
RepeatAction infiniteLoop = new RepeatAction();
infiniteLoop.setCount(RepeatAction.FOREVER);
infiniteLoop.setAction(rotateAction);
this.addAction(infiniteLoop);
}
示例14: setOnStateImageAction
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
public RepeatAction setOnStateImageAction(float duration) {
SequenceAction sequenceAction = new SequenceAction();
sequenceAction.addAction(Actions.scaleTo(1.3f, 1.3f, duration));
sequenceAction.addAction(Actions.scaleTo(1f, 1f, duration));
RepeatAction infiniteLoop = new RepeatAction();
infiniteLoop.setCount(RepeatAction.FOREVER);
infiniteLoop.setAction(sequenceAction);
return infiniteLoop;
}
示例15: getAlphaAction
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; //导入依赖的package包/类
private Action getAlphaAction() {
SequenceAction sa = Actions.sequence();
sa.addAction(Actions.delay(1f));
sa.addAction(Actions.alpha(1f, 4f));
sa.addAction(Actions.delay(4f));
sa.addAction(Actions.alpha(0f, 2f));
sa.addAction(Actions.delay(1f));
return sa;
}