@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))); }
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); }
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); }
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; } })); } } }
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"); } }
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(); }
@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; }
@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; }
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); }
@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; } }
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; }
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))); }
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); }
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; }
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; }
private Action getVolumeAction(Music music) { SequenceAction sa = Actions.sequence(); sa.addAction(Actions.delay(1f)); sa.addAction(new MusicVolumeAction(music, .7f, 4f)); sa.addAction(Actions.delay(4f)); sa.addAction(new MusicVolumeAction(music, 0f, 2f)); sa.addAction(Actions.delay(1f)); if (onDone != null) { sa.addAction(Actions.run(onDone)); } return sa; }
@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; }
public void hide() { //fade out and then remove clearActions(); AlphaAction alphaAction = new AlphaAction(); alphaAction.setAlpha(0.0f); alphaAction.setDuration(.3f); alphaAction.setInterpolation(Interpolation.fade); RemoveActorAction removeAction = new RemoveActorAction(); removeAction.setActor(this); SequenceAction sequenceAction = new SequenceAction(alphaAction, removeAction); addAction(sequenceAction); }
public void switchScreen(final Game game, final Screen newScreen, Stage stage){ stage.getRoot().getColor().a = 1; SequenceAction sequenceAction = new SequenceAction(); sequenceAction.addAction(fadeOut(0.5f)); sequenceAction.addAction(run(new Runnable() { @Override public void run() { game.setScreen(newScreen); } })); stage.getRoot().addAction(sequenceAction); }
@Override public void addAppearAction() { SequenceAction actions = new SequenceAction( ActionFacade.createMoveAction(getX() + move.x, getY(), 0.3f), new DeleteItemAction(this)); addAction(actions); }
@Override public void addAppearAction() { SequenceAction actions = new SequenceAction( ActionFacade.createMoveAction(getX(), getY(), 0.15f), new DeleteItemAction(this)); addAction(actions); }
@Override public void addAppearAction() { SequenceAction actions = new SequenceAction( ActionFacade.createMoveAction(getX(), getY()+2, 0.2f), ActionFacade.createMoveAction(getX(), getY()+2, 0.25f), new DeleteItemAction(this)); addAction(actions); }
public void clearContextMenu( boolean releaseLock ) { if (releaseLock) { lockContextMenu = false; } if ( lockContextMenu ) { return; } if (keyboardHelper != null) { keyboardHelper.clear(); keyboardHelper = null; } if ( contextMenu != null ) { contextMenu.addAction( new SequenceAction( Actions.fadeOut( 0.25f ), Actions.removeActor() ) ); contextMenu = null; if (contextMenuQueue.size > 0) { ContextMenuData data = contextMenuQueue.removeIndex(0); displayContextMenu( data.content, true, data.keyboardHelper ); } } }
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; }
public void addTouchAction( float x, float y ) { if (skin == null) { return; } Widget widget = new Label("O", skin); widget.setColor( 0, 0, 0, 0 ); widget.addAction( new SequenceAction( Actions.delay( 2 ), Actions.removeActor() ) ); widget.setPosition( x - widget.getWidth()/2, y - widget.getHeight()/2 ); stage.addActor( widget ); widget.setVisible( true ); }
public void addFullScreenMessage( String message ) { Label label = new Label( message, skin, "title" ); label.setColor( Color.WHITE ); int cx = 50; int cy = Global.Resolution[ 1 ] - 50; label.addAction( new SequenceAction( Actions.moveTo( cx + 25, cy, 2.5f ), Actions.removeActor() ) ); label.setPosition( cx, cy ); stage.addActor( label ); label.setVisible( true ); }
public Tutorial(Rectangle bounds, String assetsId, String text) { this.bounds = bounds; this.text = text; textureRegion = AssetsManager.getTextureRegion(assetsId); SequenceAction sequenceAction = new SequenceAction(); sequenceAction.addAction(Actions.delay(4f)); sequenceAction.addAction(Actions.removeActor()); addAction(sequenceAction); font = AssetsManager.getSmallestFont(); setWidth(bounds.width); setHeight(bounds.height); }
/** * eine Hilfsmethode. * die das Sprechballonbild und die Label ein- und nach * kurzer Zeit wieder ausblendet */ private static void getActorSpeech() { float fade1 = 1; float fade2 = 2.5f; SequenceAction act1 = Actions.sequence(Actions.fadeIn(fade1), Actions.delay(2), Actions.fadeOut(fade2)); SequenceAction act2 = Actions.sequence(Actions.fadeIn(fade1), Actions.delay(2), Actions.fadeOut(fade2)); speechBalloon.addAction(act1); label.addAction(act2); }
@Override protected SequenceAction generateActionSequenz() { Action minimize = Actions.scaleTo(0.01f, 0.01f, 0.0f); Action grow = Actions.scaleTo(1.1f, 1.1f, 0.25f); Action shrink = Actions.scaleTo(0.8f, 0.8f, 0.25f); Action normalize = Actions.scaleTo(1, 1, 0.25f); fallingtime = (((float) Math.random()) * 1.5f) + 2.5f; Action move = Actions.moveBy(0.0f, -1280.0f - (this.getHeight() * this.getScaleY()), fallingtime); return Actions.sequence(minimize, grow, shrink, normalize, move); }
/** * Fall-Animations/Bewegungs - Sequenz. * * @return SequenceAction */ protected SequenceAction generateActionSequenz() { Action minimize = Actions.scaleTo(0.01f, 0.01f, 0.0f); Action grow = Actions.scaleTo(0.6f, 0.6f, 0.25f); Action shrink = Actions.scaleTo(0.4f, 0.4f, 0.25f); Action normalize = Actions.scaleTo(0.5f, 0.5f, 0.25f); fallingtime = (((float) Math.random()) * 1.5f) + 2.5f; Action move = Actions.moveBy(0.0f, -1360.0f, fallingtime); // Hard coded 1360 - should just fall threw the bottom. Hardcoded to save return Actions.sequence(minimize, grow, shrink, normalize, move); }
/** * Popup wird ausgeblendet und dispost. */ public final void fadeOut() { Action completeAction = new CompleteAction() { @Override public void done() { Popup.this.remove(); } }; content.addAction(new SequenceAction(Actions.fadeOut(fadeTime), completeAction)); }
@Override public void hide(Runnable runnable) { colorPicker.setUpPickedColor(); SequenceAction hideAction = getHideAction(runnable); hideAction.addAction(Actions.run(colorPicker.getReleaseResources())); addAction(hideAction); }
protected SequenceAction getHideAction(Runnable runnable) { SequenceAction preHide = Actions.sequence(); for (Runnable r : hideRunnables) { preHide.addAction(Actions.run(r)); } SequenceAction hide = Actions.sequence(Actions.parallel(Actions .fadeOut(FADE, Interpolation.fade), Actions.moveBy(0f, getHeight() * HIDE_OFFSET, FADE, Interpolation.exp5Out))); if (runnable != null) { hide.addAction(Actions.run(runnable)); } preHide.addAction(hide); return preHide; }
/** * 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(); } }
public final void b(String paramString) { this.a.a(false); ActionButton.b(this.a).setText(paramString); ActionButton.e(this.a).setText(paramString); if (ActionButton.b(this.a).getParent() == null) { ActionButton.a(this.a).remove(); ActionButton.c(this.a).addActor(ActionButton.b(this.a)); ActionButton.b(this.a).clearActions(); SequenceAction localSequenceAction = Actions.sequence(new e(), new f(ActionButton.b(this.a))); ActionButton.b(this.a).addAction(Actions.sequence(localSequenceAction, Actions.forever(Actions.delay(3.0F, localSequenceAction)))); } }
public void startAction(RunnableAction action) { table.addAction(new SequenceAction(getDefaultHideAnimation(), action)); }
public void Fadeout(){ MoveToAction out = new MoveToAction(); out.setPosition(0.0f, Gdx.graphics.getHeight() * 0.1f); out.setDuration(2f); gr.addAction(new SequenceAction(new DelayAction(7f), out)); }
private void showCharacterDialog() { Dialog dialog = new Dialog("", skin); Label label = new Label("Choose a character...", skin); dialog.getContentTable().add(label); dialog.getContentTable().row(); Table table = new Table(); ScrollPane scrollPane = new ScrollPane(table, skin); scrollPane.setFadeScrollBars(false); dialog.getContentTable().add(scrollPane).grow(); final ButtonGroup<ImageTextButton> buttons = new ButtonGroup<ImageTextButton>(); for (String name : getCore().getImagePacks().get(DATA_PATH + "/characters")) { Drawable drawable = new TextureRegionDrawable(getCore().getAtlas().findRegion(name)); Image image = new Image(drawable); ImageTextButton imageTextButton = new ImageTextButton(name, skin, "list"); imageTextButton.getImageCell().setActor(image); imageTextButton.getLabelCell().left().expandX(); table.add(imageTextButton).growX(); buttons.add(imageTextButton); table.row(); } dialog.getContentTable().row(); TextButton textButton = new TextButton("OK", skin); dialog.getContentTable().add(textButton); textButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/coin.wav", Sound.class).play(); ((GameState)getCore().getStateManager().getState("game")).setSelectedCharacter(buttons.getChecked().getText().toString()); Gdx.input.setInputProcessor(null); Action changeStateAction = new Action() { @Override public boolean act(float delta) { getCore().getStateManager().loadState("game"); return true; } }; root.addAction(new SequenceAction(new DelayAction(.5f), changeStateAction)); } }); dialog.show(stage); dialog.setSize(400.0f, 400.0f); dialog.setPosition(stage.getWidth() / 2.0f, stage.getHeight() / 2.0f, Align.center); stage.setScrollFocus(scrollPane); }