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 clickProgressBar(int screenX,int screenY){ if((screenX>barExperience.getX()) && (screenY <(Gdx.graphics.getHeight()-barExperience.getY()))) { FadeIn(); gr.addAction(new DelayAction(5f)); Fadeout(); } }
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))); }
@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 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); }