当前位置: 首页>>代码示例>>Java>>正文


Java Actions类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.actions.Actions的典型用法代码示例。如果您正苦于以下问题:Java Actions类的具体用法?Java Actions怎么用?Java Actions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Actions类属于com.badlogic.gdx.scenes.scene2d.actions包,在下文中一共展示了Actions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
@Override
public void create () {
    camera = new OrthographicCamera();
    camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    stage = new Stage();
    stage.addListener(new InputListener(){
        @Override
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button){

            stage.getActors().get(counter).addAction(Actions.moveTo(x-50,y-50,1));
            counter++;
            if(counter==stage.getActors().size) {
                counter=0;
            }
            return true;
        }
    });
    Gdx.input.setInputProcessor(stage);
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:20,代码来源:NoRiskNoFunDrawFigures.java

示例2: displayScores

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
@Override
public void displayScores(List<PlayerData> data) {
    table.clear();
    table.row();
    Label winner = new Label("Last penguin standing: " + data.get(0).displayName, uiSkin);
    table.add(winner).pad(10);

    for (int i = 0; i < data.size(); i++) {
        int rank = i + 1;
        PlayerData player = data.get(i);
        table.row();
        String newBest = getBestText(player);
        Label l = new Label(rank + ". " + player.displayName + " " + data.get(i).totalScore + newBest, uiSkin);
        table.add(l).pad(5);
    }
    table.row();
    table.add(menuButton).pad(30);
    menuButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            controller.onBack();
        }
    });
    table.addAction(Actions.fadeIn(1));
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:26,代码来源:ScoreView.java

示例3: hide

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
private void hide() {
    shown = false;
    hiding = true;
    Gdx.input.setInputProcessor(lastInputProcessor);

    addAction(Actions.sequence(
            Actions.moveTo(0, Gdx.graphics.getHeight(), 0.5f, Interpolation.swingIn),
            new RunnableAction() {
                @Override
                public void run() {
                    hiding = false;
                }
            }
    ));
    scorer.resume();
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:17,代码来源:PauseMenuStage.java

示例4: setUpSkinImages

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的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);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:23,代码来源:MarketScreen.java

示例5: reactOnClick

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
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));
    }
}
 
开发者ID:BePeGames,项目名称:ClickerGame,代码行数:24,代码来源:Player.java

示例6: showLevelComplete

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
private void showLevelComplete() {
    levelCompleteBackground.setVisible(true);
    nextButton.getColor().a = 0;
    nextButton.addAction(Actions.alpha(1, 1.5f));
    nextButton.setVisible(true);

    long duration = DAO.getInstance().getLong(DAO.TOTAL_TIME_KEY, 0);
    levelSummaryLabel.setText("TIME TAKEN: " + getTimeTakenDisplay(duration));
    levelSummaryLabel.setVisible(true);

    if (!Globals.isDesktop() && moveButton != null && jumpButton != null) {
        moveButton.setDisabled(true);
        moveButton.setVisible(false);
        jumpButton.setDisabled(true);
        jumpButton.setVisible(false);
    }
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:18,代码来源:HUD.java

示例7: tweenToHidden

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
private void tweenToHidden(float duration, Runnable callback) {
    Table menuTable = menuBar.getTable();

    /*
    menuBar.getTable().setPosition(0, Gdx.graphics.getHeight()+menuBar.getTable().getHeight());
    menuBar.getTable().getColor().a = 0;
     */

    menuTable.addAction(Actions.sequence(
        Actions.parallel(
            Actions.moveTo(0, Gdx.graphics.getHeight()+menuBar.getTable().getHeight(), duration),
            Actions.fadeOut(duration)
        ), Actions.run(() ->{
            if(callback != null) callback.run();
        })
    ));
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:18,代码来源:VisualEditorRoot.java

示例8: backClick

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
private void backClick() {

        float nextXPos = Gdx.graphics.getWidth() + CB.scaledSizes.MARGIN;

        if (listViews.size == 1) {
            // remove all BackClickListener
            while (listBackClickListener.size > 0) {
                StageManager.unRegisterForBackKey(listBackClickListener.pop());
            }

            //Send click to Cancel button
            cancelClickListener.clicked(StageManager.BACK_KEY_INPUT_EVENT, -1, -1);
            return;
        }

        StageManager.unRegisterForBackKey(listBackClickListener.pop());
        listViewsNames.pop();
        WidgetGroup actWidgetGroup = listViews.pop();
        WidgetGroup showingWidgetGroup = listViews.get(listViews.size - 1);

        float y = actWidgetGroup.getY();
        actWidgetGroup.addAction(Actions.sequence(Actions.moveTo(nextXPos, y, Menu.MORE_MENU_ANIMATION_TIME), Actions.removeActor()));
        showingWidgetGroup.addAction(Actions.moveTo(CB.scaledSizes.MARGIN, y, Menu.MORE_MENU_ANIMATION_TIME));
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:25,代码来源:Settings_Activity.java

示例9: act

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
@Override
public void act(float delta) {
    super.act(delta);

    if (lastTime == -1) lastTime = System.currentTimeMillis();


    delta = ((System.currentTimeMillis() - lastTime) / 1000f);
    lastTime = System.currentTimeMillis();
    actTime += delta;

    if (!fadeOutRuns && actTime > TIME_TO_FADE_OUT) {
        this.addAction(Actions.alpha(style.alphaOff, 2f));
        this.fadeOutRuns = true;
    }

    if (!fadeOutRuns) {
        //wait for fade out
        Gdx.graphics.requestRendering();
    }
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:22,代码来源:ZoomButton.java

示例10: showWidgetGroup

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
private void showWidgetGroup() {
    clearActions();
    pack();

    mainMenuWidgetGroup = new WidgetGroup();
    mainMenuWidgetGroup.setName(this.name.toString());
    mainMenuWidgetGroup.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
    mainMenuWidgetGroup.addActor(this);

    if (this.parentMenu == null) {
        showingStage = StageManager.showOnNewStage(mainMenuWidgetGroup);
    } else {
        showingStage = StageManager.showOnActStage(mainMenuWidgetGroup);
    }

    if (this.parentMenu == null)
        addAction(sequence(Actions.alpha(0), Actions.fadeIn(CB.WINDOW_FADE_TIME, Interpolation.fade)));
    isShowing = true;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:20,代码来源:Menu.java

示例11: hide

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
public void hide(boolean all) {
    if (this.onHideListener != null) {
        this.onHideListener.onHide();
    }
    if (!isShowing) return;
    if (this.parentMenu != null) {
        if (all) {
            StageManager.removeAllWithActStage(showingStage);
            StageManager.unRegisterForBackKey(backClickListener);
        } else {
            float nextXPos = Gdx.graphics.getWidth() + CB.scaledSizes.MARGIN;
            mainMenuWidgetGroup.addAction(Actions.sequence(Actions.moveTo(0 + nextXPos, 0, MORE_MENU_ANIMATION_TIME), Actions.removeActor()));
            parentMenu.mainMenuWidgetGroup.addAction(Actions.moveTo(0, 0, MORE_MENU_ANIMATION_TIME));
        }
    } else {
        super.hide();
        StageManager.unRegisterForBackKey(backClickListener);
    }
    log.debug("Hide menu: " + this.name);
    isShowing = false;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:22,代码来源:Menu.java

示例12: show

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
@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);
        }
    })));
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:25,代码来源:GameController.java

示例13: showFreeze

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
private void showFreeze(final Creature creature) {
    final TileSubView freeze = new TileSubView("creature-effect-freeze");
    freeze.getActor().getColor().a = 0f;
    final WorldObjectView view = visualizer.viewController.getView(creature);
    view.addSubView(freeze);
    freeze.getActor().addAction(alpha(1, 0.5f));
    visualizer.viewController.world.dispatcher.add(Creature.REMOVE_EFFECT, new EventListener<EffectEvent>() {
        @Override public void handle(EventType<EffectEvent> type, EffectEvent event) {
            if (event.creature == creature && event.effect instanceof FreezeEffect) {
                freeze.getActor().addAction(Actions.sequence(
                    Actions.alpha(0, 0.5f),
                    Actions.run(new Runnable() {
                        @Override public void run() {
                            view.removeSubView(freeze);
                        }
                    })
                ));
            }
        }
    });
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:22,代码来源:IceStormVisualizer.java

示例14: visualize

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
@Override public IFuture<Void> visualize(final AddEffect result) {
    final Array<TextureAtlas.AtlasRegion> regions = Config.findRegions("animation/effect-" + result.ability.name);
    if (regions.size == 0)
        return Future.completed();
    final WorldObjectView view = visualizer.viewController.getView(result.getTarget());
    final AnimationSubView subView = new AnimationSubView(0.1f, regions, Animation.PlayMode.LOOP);
    subView.getActor().setPosition(1, 2);
    subView.priority = 1;
    view.addSubView(subView);
    visualizer.viewController.world.dispatcher.add(Creature.REMOVE_EFFECT, new EventListener<EffectEvent>() {
        @Override public void handle(EventType<EffectEvent> type, EffectEvent event) {
            if (event.effect != result.effectToApply || event.creature != result.creatureToAddEffect)
                return;
            visualizer.viewController.world.dispatcher.remove(Creature.REMOVE_EFFECT, this);
            SoundManager.instance.playMusicAsSound("boss-protection-loss");
            subView.getActor().addAction(Actions.alpha(0, DURATION));
            subView.getActor().addAction(Actions.delay(DURATION, Actions.run(new Runnable() {
                @Override public void run() {
                    view.removeSubView(subView);
                }
            })));
        }
    });
    return Future.completed();
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:26,代码来源:AddEffectVisualizer.java

示例15: visualize

import com.badlogic.gdx.scenes.scene2d.actions.Actions; //导入依赖的package包/类
@Override public IFuture<Void> visualize(PoisonShotResult result) {
    final Future<Void> future = new Future<Void>();
    final WorldObjectView actorView = visualizer.viewController.getView(result.creature);
    WorldObjectView targetView = visualizer.viewController.getView(result.target);
    Vector2 direction = tmp.set(result.target.getX(), result.target.getY()).sub(result.creature.getX(), result.creature.getY());

    visualizer.viewController.scroller.centerOn(result.target);
    float dx = targetView.getX() - actorView.getX();
    float dy = targetView.getY() - actorView.getY();

    final ImageSubView arrow = new ImageSubView("animation/poison-dart");
    arrow.getActor().setOrigin(13, 14);
    arrow.getActor().setRotation(direction.angle());
    arrow.getActor().addAction(Actions.sequence(
        Actions.moveBy(dx, dy, tmp.set(dx, dy).len() * 0.003f),
        Actions.run(new Runnable() {
            @Override public void run() {
                SoundManager.instance.playSound("arrow-shot");
                actorView.removeSubView(arrow);
                future.happen();
            }
        })
    ));
    actorView.addSubView(arrow);
    return future;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:27,代码来源:PoisonDartVisualizer.java


注:本文中的com.badlogic.gdx.scenes.scene2d.actions.Actions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。