Java 类com.badlogic.gdx.scenes.scene2d.Action 实例源码

项目:cocos-ui-libgdx    文件:CCSpriteViewTest.java   
@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)));
}
项目:gdx-controllerutils    文件:ControllerMenuDialog.java   
@Override
public Dialog show(Stage stage, Action action) {
    previousFocussedActor = null;
    previousEscapeActor = null;

    super.show(stage, action);

    if (stage instanceof ControllerMenuStage) {
        previousFocussedActor = ((ControllerMenuStage) stage).getFocussedActor();
        previousEscapeActor = ((ControllerMenuStage) stage).getEscapeActor();

        if (buttonsToAdd.size >= 1)
            ((ControllerMenuStage) stage).setFocussedActor(buttonsToAdd.get(0));

        if (buttonsToAdd.size == 1)
            ((ControllerMenuStage) stage).setEscapeActor(buttonsToAdd.get(0));
    }

    return this;

}
项目:ClickerGame    文件:Player.java   
public void reactOnClick() {
    //Action testAction = Actions.moveBy(10, 15);//sizeBy, moveBy and other action :D
    int xMoveAmount = MathUtils.random(-130, 130);

    Action moveAction = Actions.sequence(
            Actions.moveBy(xMoveAmount, 10, 0.30f, Interpolation.circleOut),
            Actions.moveBy(-xMoveAmount, -10, 0.30f, Interpolation.circle)
    );

    int yGrowAmount = MathUtils.random(-30, 100);

    Action growAction = Actions.sequence(
            Actions.sizeBy(yGrowAmount, 20, 0.2f, Interpolation.circleOut),
            Actions.sizeBy(-yGrowAmount, -20, 0.2f, Interpolation.circle)
    );

    this.addAction(moveAction);
    this.addAction(growAction);

    if(this.getHeight() > 170) {
        this.addAction(Actions.rotateBy(MathUtils.randomSign() * 360, 0.4f));
    }
}
项目:skin-composer    文件:DialogWelcome.java   
@Override
public Dialog show(Stage stage, Action action) {
    Dialog dialog = super.show(stage, action);

    if (getWidth() > Gdx.graphics.getWidth()) {
        setWidth(Gdx.graphics.getWidth());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }

    if (getHeight() > Gdx.graphics.getHeight()) {
        setHeight(Gdx.graphics.getHeight());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }

    resetWidth = getWidth();
    resetHeight = getHeight();
    main.getStage().setScrollFocus(scrollPane);
    return dialog;
}
项目:skin-composer    文件:DialogWarnings.java   
@Override
public Dialog show(Stage stage, Action action) {
    Dialog dialog = super.show(stage, action);

    if (getWidth() > Gdx.graphics.getWidth()) {
        setWidth(Gdx.graphics.getWidth());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }

    if (getHeight() > Gdx.graphics.getHeight()) {
        setHeight(Gdx.graphics.getHeight());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }

    resetWidth = getWidth();
    resetHeight = getHeight();
    main.getStage().setScrollFocus(scrollPane);
    return dialog;
}
项目:skin-composer    文件:RootTable.java   
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;
                }
            }));
        }
    }
}
项目:space-travels-3    文件:HudScreen.java   
private Actor getFuelIndicator(float width)
{
    if (this.ship.isInfiniteFuel())
    {
        Label infiniteFuelLabel = new Label("inf", UIManager.skin);
        return infiniteFuelLabel;
    }
    else
    {
        final ProgressBar fuelProgressBar =
            UIManager.getDelimitedProgressBar(this.ship.getMaxFuel(), width);

        fuelProgressBar.addAction(new Action()
        {
            @Override
            public boolean act(float delta)
            {
                fuelProgressBar.setValue(HudScreen.this.ship.getCurrentFuel());
                return false;
            }
        });
        return fuelProgressBar;
    }
}
项目:M-M    文件:GameController.java   
@Override
public void show(final Stage stage, final Action action) {
    bonuses.clear();
    effects.clear();
    box2d.create();
    minionSprites.clear();
    running = true;
    timer = 0f;
    background = gameAssetService.getRandomBackground();
    for (final Table table : playerViews) {
        table.setVisible(false);
    }
    createPlayerSprites();
    createBlockSprites();
    createMinionSprites();
    super.show(stage, Actions.sequence(action, Actions.run(new Runnable() {
        @Override
        public void run() { // Listening to user input events:
            final InputMultiplexer inputMultiplexer = new InputMultiplexer(stage);
            box2d.initiateControls(inputMultiplexer);
            Gdx.input.setInputProcessor(inputMultiplexer);
        }
    })));
}
项目:dice-heroes    文件:SoundManager.java   
public void playMusicBeautifully(String name, Stage stage) {
    final Music music = musics.get(name);
    if (music == null) {
        Logger.error("there is no music for " + name);
        return;
    }
    music.setVolume(0);
    if (!usesMusic) {
        disabledMusics.add(music);
    } else {
        music.play();
    }
    music.setLooping(true);
    playingMusics.add(music);
    Action action = new TemporalAction(5f, Interpolation.linear) {
        @Override protected void update(float percent) {
            music.setVolume(percent * volume);
        }
    };
    stage.addAction(action);
    replaceAction(music, action);
}
项目:dice-heroes    文件:SoundManager.java   
public void stopMusicBeautifully(String name, Stage stage) {
    final Music music = musics.get(name);
    if (music == null) {
        Logger.error("there is no music for " + name);
        return;
    }
    final float initialVolume = music.getVolume();
    Action action = new TemporalAction(2f, Interpolation.linear) {
        @Override protected void update(float percent) {
            music.setVolume(initialVolume - percent * initialVolume);
        }

        @Override protected void end() {
            music.stop();
            playingMusics.remove(music);
            disabledMusics.remove(music);
        }
    };
    stage.addAction(action);
    replaceAction(music, action);
}
项目:dice-heroes    文件:StringSpin.java   
private void addActions(final Label label, final int i, final int idx, final float speed, final float spinTime, final float endTime, final Runnable callback) {
    label.addAction(new Action() {
        private float totalTime = spinTime + i * endTime;
        @Override public boolean act(float delta) {
            totalTime -= delta;
            label.moveBy(0, -speed * delta);
            boolean finished = totalTime <= 0;
            if (finished) {
                label.setY(-(letters.length() - idx - 1) * lineHeight);
                if (i == labels.size - 1) {
                    callback.run();
                }
            } else {
                while (label.getY() < -letters.length() * lineHeight) {
                    label.setY(label.getY() + letters.length() * lineHeight);
                }
            }
            return finished;
        }
    });
}
项目:OdysseeDesMaths    文件:MiniGameUI.java   
/**
 * Ajoute des items actifs à l'interface.
 */
public void addItems() {
    skin.add("itemCounter", new LabelStyle(skin.getFont("itemCounter"), null));

    activeItems = new HashMap<Sprite, Integer>();
    itemsGroup = new Table();
    itemsGroup.addAction(new Action() {
        @Override
        public boolean act(float delta) {
            itemsGroup.clearChildren();

            for (Map.Entry<Sprite, Integer> entry : activeItems.entrySet()) {
                itemImage = new Image(entry.getKey());
                itemsGroup.add(itemImage).padRight(Gdx.graphics.getWidth() / 50);
                itemCounter = new Label(entry.getValue().toString(), skin, "itemCounter");
                itemsGroup.add(itemCounter).padRight(Gdx.graphics.getWidth() / 15);
            }

            return false;
        }
    });

    itemsContainer.setActor(itemsGroup);
}
项目:gdx-autumn-mvc    文件:InterfaceService.java   
private ActionProvider getDefaultViewShowingActionProvider() {
    return new ActionProvider() {
        @Override
        public Action provideAction(final ViewController forController, final ViewController previousController) {
            if (musicService.getCurrentTheme() == null && GdxArrays.isNotEmpty(forController.getThemes())) {
                final Music currentTheme = forController.getThemes().random();
                return Actions.sequence(Actions.alpha(0f), Actions.fadeIn(DEFAULT_FADING_TIME),
                        Actions.run(CommonActionRunnables.getMusicThemeSetterRunnable(musicService, currentTheme)),
                        Actions.run(CommonActionRunnables.getInputSetterRunnable(forController.getStage())),
                        MusicFadingAction.fadeIn(currentTheme, MusicService.DEFAULT_THEME_FADING_TIME,
                                musicService.getMusicVolume()));
            }
            return Actions.sequence(Actions.alpha(0f), Actions.fadeIn(DEFAULT_FADING_TIME),
                    Actions.run(CommonActionRunnables.getInputSetterRunnable(forController.getStage())));
        }
    };
}
项目:gdx-lml    文件:LmlApplicationListener.java   
/** @param view will be set as the current view after view transition. Current screen (if any exists) will receive a
 *            {@link AbstractLmlView#hide()} call. The new screen will be resized using
 *            {@link AbstractLmlView#resize(int, int, boolean)} and then will receive a
 *            {@link AbstractLmlView#show()} call.
 * @param doAfterHide will be executed after the current view is fully hidden. Is never executed if there was no
 *            current view.
 * @see #getViewShowingAction(AbstractLmlView)
 * @see #getViewHidingAction(AbstractLmlView) */
public void setView(final AbstractLmlView view, final Action doAfterHide) {
    if (currentView != null) {
        viewChangeRunnable.setView(view);
        Gdx.input.setInputProcessor(null);
        currentView.hide();
        final Action hideAction = doAfterHide == null
                ? Actions.sequence(getViewHidingAction(currentView), Actions.run(viewChangeRunnable))
                : Actions.sequence(getViewHidingAction(currentView), doAfterHide, Actions.run(viewChangeRunnable));
        currentView.getStage().addAction(hideAction);
    } else {
        currentView = view;
        currentView.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), isCenteringCameraOnResize());
        Gdx.input.setInputProcessor(currentView.getStage());
        currentView.show();
        currentView.getStage().addAction(getViewShowingAction(view));
    }
}
项目:gdx-lml    文件:InterfaceService.java   
private ActionProvider getDefaultViewShowingActionProvider() {
    return new ActionProvider() {
        @Override
        public Action provideAction(final ViewController forController, final ViewController previousController) {
            if (musicService.getCurrentTheme() == null && GdxArrays.isNotEmpty(forController.getThemes())) {
                final Music currentTheme = forController.getThemes().random();
                return Actions.sequence(Actions.alpha(0f), Actions.fadeIn(DEFAULT_FADING_TIME),
                        Actions.run(CommonActionRunnables.getMusicThemeSetterRunnable(musicService, currentTheme)),
                        Actions.run(CommonActionRunnables.getInputSetterRunnable(forController.getStage())),
                        MusicFadingAction.fadeIn(currentTheme, MusicService.DEFAULT_THEME_FADING_TIME,
                                musicService.getMusicVolume()));
            }
            return Actions.sequence(Actions.alpha(0f), Actions.fadeIn(DEFAULT_FADING_TIME),
                    Actions.run(CommonActionRunnables.getInputSetterRunnable(forController.getStage())));
        }
    };
}
项目:gdx-lml    文件:LmlApplication.java   
/** Also available as "setLocale" action in LML views. Will extract locale from actor's ID.
 *
 * @param locale will be set as the current application's locale. If is not equal to the current locale, will hide
 *            current view, reload all referenced {@link com.badlogic.gdx.utils.I18NBundle i18n bundles}, recreate
 *            all views and reshow the current view. */
public void setLocale(final Locale locale) {
    if (!localePreference.isCurrent(locale)) {
        setView(getCurrentView(), new Action() {
            private boolean reloaded = false;

            @Override
            public boolean act(final float delta) {
                if (!reloaded) {
                    reloaded = true;
                    localePreference.setLocale(locale);
                    localePreference.save();
                    reloadViews();
                }
                return true;
            }
        });
    }
}
项目:gdx-lml    文件:TabShowingActionLmlAttribute.java   
@Override
protected void process(final LmlParser parser, final LmlTag tag, final TabbedPane tabbedPane,
        final String rawAttributeData) {
    if (tag instanceof TabbedPaneLmlTag) {
        @SuppressWarnings("unchecked") final ActorConsumer<Action, Tab> action = (ActorConsumer<Action, Tab>) parser
                .parseAction(rawAttributeData, MOCK_UP_TAB);
        if (action == null) {
            parser.throwErrorIfStrict(
                    "Unable to find action consuming Tab and returning Action for ID: " + rawAttributeData);
            return;
        }
        ((TabbedPaneLmlTag) tag).setShowActionProvider(action);
    } else {
        parser.throwErrorIfStrict(
                "Unexpected tag type for tabbed pane tag. Expected: TabbedPaneLmlTag, got: " + tag.getClass());
    }
}
项目:gdx-lml    文件:TabHidingActionLmlAttribute.java   
@Override
protected void process(final LmlParser parser, final LmlTag tag, final TabbedPane tabbedPane,
        final String rawAttributeData) {
    if (tag instanceof TabbedPaneLmlTag) {
        @SuppressWarnings("unchecked") final ActorConsumer<Action, Tab> action = (ActorConsumer<Action, Tab>) parser
                .parseAction(rawAttributeData, MOCK_UP_TAB);
        if (action == null) {
            parser.throwErrorIfStrict(
                    "Unable to find action consuming Tab and returning Action for ID: " + rawAttributeData);
            return;
        }
        ((TabbedPaneLmlTag) tag).setHideActionProvider(action);
    } else {
        parser.throwErrorIfStrict(
                "Unexpected tag type for tabbed pane tag. Expected: TabbedPaneLmlTag, got: " + tag.getClass());
    }
}
项目:gdx-lml-vis    文件:TabShowingActionLmlAttribute.java   
@Override
protected void process(final LmlParser parser, final LmlTag tag, final TabbedPane tabbedPane,
        final String rawAttributeData) {
    if (tag instanceof TabbedPaneLmlTag) {
        @SuppressWarnings("unchecked") final ActorConsumer<Action, Tab> action = (ActorConsumer<Action, Tab>) parser
                .parseAction(rawAttributeData, MOCK_UP_TAB);
        if (action == null) {
            parser.throwErrorIfStrict(
                    "Unable to find action consuming Tab and returning Action for ID: " + rawAttributeData);
            return;
        }
        ((TabbedPaneLmlTag) tag).setShowActionProvider(action);
    } else {
        parser.throwErrorIfStrict(
                "Unexpected tag type for tabbed pane tag. Expected: TabbedPaneLmlTag, got: " + tag.getClass());
    }
}
项目:gdx-lml-vis    文件:TabHidingActionLmlAttribute.java   
@Override
protected void process(final LmlParser parser, final LmlTag tag, final TabbedPane tabbedPane,
        final String rawAttributeData) {
    if (tag instanceof TabbedPaneLmlTag) {
        @SuppressWarnings("unchecked") final ActorConsumer<Action, Tab> action = (ActorConsumer<Action, Tab>) parser
                .parseAction(rawAttributeData, MOCK_UP_TAB);
        if (action == null) {
            parser.throwErrorIfStrict(
                    "Unable to find action consuming Tab and returning Action for ID: " + rawAttributeData);
            return;
        }
        ((TabbedPaneLmlTag) tag).setHideActionProvider(action);
    } else {
        parser.throwErrorIfStrict(
                "Unexpected tag type for tabbed pane tag. Expected: TabbedPaneLmlTag, got: " + tag.getClass());
    }
}
项目:libgdxcn    文件:ParallelAction.java   
public boolean act (float delta) {
    if (complete) return true;
    complete = true;
    Pool pool = getPool();
    setPool(null); // Ensure this action can't be returned to the pool while executing.
    try {
        Array<Action> actions = this.actions;
        for (int i = 0, n = actions.size; i < n && actor != null; i++) {
            if (!actions.get(i).act(delta)) complete = false;
            if (actor == null) return true; // This action was removed.
        }
        return complete;
    } finally {
        setPool(pool);
    }
}
项目:libgdxcn    文件:Dialog.java   
/** {@link #pack() Packs} the dialog and adds it to the stage with custom action which can be null for instant show */
public Dialog show (Stage stage, Action action) {
    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();
    stage.addActor(this);
    stage.setKeyboardFocus(this);
    stage.setScrollFocus(this);
    if (action != null) addAction(action);

    return this;
}
项目:libgdxcn    文件:Dialog.java   
/** 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();
}
项目:libgdxcn    文件:ComplexActionTest.java   
@Override
public void create () {
    stage = new Stage();

    Action complexAction = forever(sequence(parallel(rotateBy(180, 2), scaleTo(1.4f, 1.4f, 2), alpha(0.7f, 2)),
        parallel(rotateBy(180, 2), scaleTo(1.0f, 1.0f, 2), alpha(1.0f, 2))));

    texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false);
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    final Image img1 = new Image(new TextureRegion(texture));
    img1.setSize(100, 100);
    img1.setOrigin(50, 50);
    img1.setPosition(50, 50);

    final Image img2 = new Image(new TextureRegion(texture));
    img2.setSize(50, 50);
    img2.setOrigin(50, 50);
    img2.setPosition(150, 150);

    stage.addActor(img1);
    stage.addActor(img2);

    img1.addAction(complexAction);
    // img2.action(complexAction.copy());
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect (SC).
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param duration the duration
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC(Actor actor, float scaleRatioX,
        float scaleRatioY, float duration, final Group group,
        final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Fade Out (FO).
 *
 * @param actor the actor
 * @param duration the duration
 * @param delay the delay
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_FO(Actor actor, float duration, float delay,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.delay(delay),
                Actions.fadeOut(duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Fade In (FI).
 *
 * @param actor the actor
 * @param duration the duration
 * @param delay the delay
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_FI(Actor actor, float duration, float delay,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.delay(delay),
                Actions.fadeIn(duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Move to a position.
 *
 * @param actor the actor
 * @param duration the duration
 * @param delayBefore the delay before
 * @param posX the pos x
 * @param posY the pos y
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_MT(Actor actor, float duration,
        float delayBefore, float posX, float posY, final Group group,
        final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.delay(delayBefore),
                Actions.moveTo(posX, posY, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Shake effect (SHK).
 *
 * @param actor the actor
 * @param shakeAngle the shake angle
 * @param originalAngle the original angle
 * @param duration the duration
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SHK(Actor actor, float shakeAngle,
        float originalAngle, float duration, final Group group,
        final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.rotateTo(shakeAngle, duration),
                Actions.rotateTo(-shakeAngle, duration),
                Actions.rotateTo(originalAngle, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect and Back to previous scale (SC, BTN).
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param duration the duration
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC_BTN(Actor actor, float scaleRatioX,
        float scaleRatioY, float duration, final Group group,
        final boolean removeActor) {
    if (actor != null) {
        float originalScaleX = actor.getScaleX();
        float originalScaleY = actor.getScaleY();
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.scaleTo(originalScaleX, originalScaleY, duration),
                new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect and Back to original (1.0f)
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param duration the duration
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC_BTO(Actor actor, float scaleRatioX,
        float scaleRatioY, float duration, final Group group,
        final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.scaleTo(1.0f, 1.0f, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect, Fade Out (SC, FO).
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param duration the duration
 * @param delayBeforeFadeOut the delay before fade out
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC_FO(Actor actor, float scaleRatioX,
        float scaleRatioY, float duration, float delayBeforeFadeOut,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.delay(delayBeforeFadeOut),
                Actions.fadeOut(duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect, Shake effect (SC, SHK).
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param shakeAngle the shake angle
 * @param originalAngle the original angle
 * @param duration the duration
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC_SHK(Actor actor, float scaleRatioX,
        float scaleRatioY, float shakeAngle, float originalAngle,
        float duration, final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.rotateTo(shakeAngle, duration),
                Actions.rotateTo(-shakeAngle, duration),
                Actions.rotateTo(originalAngle, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect, Back To Normal, Fade Out (SC, BTN, FO).
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param duration the duration
 * @param delayBeforeFadeOut the delay before fade out
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC_BTN_FO(Actor actor, float scaleRatioX,
        float scaleRatioY, float duration, float delayBeforeFadeOut,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.scaleTo(1, 1, duration),
                Actions.delay(delayBeforeFadeOut),
                Actions.fadeOut(duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:MathAttack    文件:EffectCreator.java   
/**
 * Scale effect, Shake effect, Back To Normal (SC, SHK, BTN).
 *
 * @param actor the actor
 * @param scaleRatioX the scale ratio x
 * @param scaleRatioY the scale ratio y
 * @param shakeAngle the shake angle
 * @param originalAngle the original angle
 * @param duration the duration
 * @param group the group
 * @param removeActor the remove actor
 */
public static void create_SC_SHK_BTN(Actor actor, float scaleRatioX,
        float scaleRatioY, float shakeAngle, float originalAngle,
        float duration, final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(
                Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.rotateTo(shakeAngle, duration),
                Actions.rotateTo(-shakeAngle, duration),
                Actions.rotateTo(originalAngle, duration),
                Actions.scaleTo(1, 1, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}
项目:tafl    文件:InstructionScreen.java   
private void createPageTransition(int current, int next) {
    final Image instruction = instructions[current];
    final Image nextInstruciton = instructions[next];

    float newX = -instruction.getWidth();
    if (next < current) {
        newX = instruction.getHeight();
    }

    instruction.clearActions();
    instruction.addAction(Actions.sequence(Actions.moveTo(
            newX, instruction.getY(),
            Constants.ScreenConstants.INSTRUCTION_SLIDE_DURATION),
            new Action() {
        @Override
        public boolean act(float delta) {
            nextInstruciton.setZIndex(TOP_SCREEN_Z_ORDER);
            hide(instruction);
            return true;
        }
    }));
}
项目:ludum30_a_hole_new_world    文件:EndingScreen.java   
public EndingScreen() {

        this.bg = new BGAnimated(Assets.SequenceEnding);
        this.stage.addActor(this.bg);
        if(Assets.musicBoss.isLooping())
            Assets.musicBoss.stop();

        this.stage.addAction(new Action() {
            @Override
            public boolean act(float delta) {
                EndingScreen.this.bg.act(delta);
                if ((Assets.SequenceEnding.getKeyFrameIndex(EndingScreen.this.bg.stateTime) == 20) && (!EndingScreen.this.lighningAlreadyPlaying)){
                    Assets.playSound("lightning");
                    lighningAlreadyPlaying = true;
                }
                if (Assets.SequenceEnding.isAnimationFinished(EndingScreen.this.bg.stateTime))
                    bg.animation = new Animation(0, Assets.SequenceEnding.getKeyFrames()[Assets.SequenceEnding.getKeyFrames().length - 1]);

                return false;
            }
        });
        this.configControllers = new ConfigControllers(this);
        this.configControllers.init();
    }
项目:gaiasky    文件:GenericDialog.java   
/**
 * 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();

    // Enable input
    EventManager.instance.post(Events.INPUT_ENABLED_CMD, true);
}
项目:ninja-rabbit    文件:LevelStartScreen.java   
@Override
public void show() {
    // Fade in / fade out effect
    stage.addAction(sequence(fadeIn(0.75f), delay(1.75f), fadeOut(0.35f), new Action() {
        @Override
        public boolean act(final float delta) {
            // Last action will move to the next screen
            if (levelScreen == null) {
                game.setScreen(new LevelScreen(game));
            } else {
                game.setScreen(levelScreen);
            }
            return true;
        }
    }));
}
项目:gdx-controllerutils    文件:ControllerMenuDialog.java   
@Override
public void hide(Action action) {
    if (getStage() != null && getStage() instanceof ControllerMenuStage) {
        Actor currentFocussedActor = ((ControllerMenuStage) getStage()).getFocussedActor();
        if (previousFocussedActor != null && previousFocussedActor.getStage() == getStage()
                && (currentFocussedActor == null || currentFocussedActor.isDescendantOf(this)))
            ((ControllerMenuStage) getStage()).setFocussedActor(previousFocussedActor);
        Actor currentEscapeActor = ((ControllerMenuStage) getStage()).getEscapeActor();
        if (previousEscapeActor != null && previousEscapeActor.getStage() == getStage()
                && (currentEscapeActor == null || currentEscapeActor.isDescendantOf(this)))
            ((ControllerMenuStage) getStage()).setEscapeActor(previousEscapeActor);
    }

    super.hide(action);
}