• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MoveYModifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MoveYModifier类属于org.andengine.entity.modifier包,在下文中一共展示了MoveYModifier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: pass

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void pass(Word word, final float wordX) {
    //TODO: count success
    Debug.d("ImageMatchGame : pass!");
    GameSounds.play(GameSounds.COMPLETE);
    this.winnings.add(word);
    float available_width = (this.cardPane.getWidth()/this.max_choices);
    float wordY = this.resultsPane.getHeight() + this.cardPane.getHeight() - 150;

    ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
    Sprite winning_sprite = new Sprite(wordX+(available_width/2), wordY, sprite_region.getTextureRegion(1), PhoeniciaContext.vboManager);
    this.resultsPane.attachChild(winning_sprite);
    winning_sprite.registerEntityModifier(new ParallelEntityModifier(
            new ScaleModifier(0.5f, 2.0f, 1.0f),
            new MoveYModifier(0.5f, wordY, 80),
            new MoveXModifier(0.5f, wordX+(available_width/2), 40+(this.result_number*80))
            ));
    this.result_number++;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:19,代码来源:ImageMatchGameHUD.java


示例2: fail

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void fail(Word word, final float wordX) {
    //TODO: count failure
    Debug.d("ImageMatchGame : fail!");
    GameSounds.play(GameSounds.FAILED);
    float available_width = (this.cardPane.getWidth()/this.max_choices);
    float wordY = this.resultsPane.getHeight() + this.cardPane.getHeight() - 150;

    ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
    Sprite missed_sprite = new Sprite(wordX+(available_width/2), wordY, sprite_region.getTextureRegion(2), PhoeniciaContext.vboManager);
    this.resultsPane.attachChild(missed_sprite);
    missed_sprite.registerEntityModifier(new ParallelEntityModifier(
            new ScaleModifier(0.5f, 2.0f, 1.0f),
            new MoveYModifier(0.5f, wordY, 80),
            new MoveXModifier(0.5f, wordX+(available_width/2), 48+(this.result_number*80))
            ));
    this.result_number++;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:18,代码来源:ImageMatchGameHUD.java


示例3: pass

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void pass(Word word, final float wordX) {
    Debug.d("NumberMatchGame : pass!");
    GameSounds.play(GameSounds.COMPLETE);
    this.winnings.add(word);
    float available_width = (this.cardPane.getWidth()/this.max_choices);
    float wordY = this.resultsPane.getHeight() + this.cardPane.getHeight() - 150;

    ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
    Sprite winning_sprite = new Sprite(wordX+(available_width/2), wordY, sprite_region.getTextureRegion(1), PhoeniciaContext.vboManager);
    this.resultsPane.attachChild(winning_sprite);
    winning_sprite.registerEntityModifier(new ParallelEntityModifier(
            new ScaleModifier(0.5f, 2.0f, 1.0f),
            new MoveYModifier(0.5f, wordY, 80),
            new MoveXModifier(0.5f, wordX+(available_width/2), 40+(this.result_number*80))
    ));
    this.result_number++;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:18,代码来源:NumberMatchGameHUD.java


示例4: fail

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void fail(Word word, final float wordX) {
    Debug.d("NumberMatchGame : fail!");
    GameSounds.play(GameSounds.FAILED);
    float available_width = (this.cardPane.getWidth()/this.max_choices);
    float wordY = this.resultsPane.getHeight() + this.cardPane.getHeight() - 150;

    ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
    Sprite missed_sprite = new Sprite(wordX+(available_width/2), wordY, sprite_region.getTextureRegion(2), PhoeniciaContext.vboManager);
    this.resultsPane.attachChild(missed_sprite);
    missed_sprite.registerEntityModifier(new ParallelEntityModifier(
            new ScaleModifier(0.5f, 2.0f, 1.0f),
            new MoveYModifier(0.5f, wordY, 80),
            new MoveXModifier(0.5f, wordX + (available_width / 2), 48 + (this.result_number * 80))
    ));
    this.result_number++;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:NumberMatchGameHUD.java


示例5: show

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
/**
 * Animate the on-screen elements entering the scene
 */
@Override
public void show() {
    //inventoryBlock.registerEntityModifier(new MoveYModifier(0.5f, -48, 64, EaseBackOut.getInstance()));
    letterBlock.registerEntityModifier(new MoveYModifier(0.5f, -(letterBlock.getHeight()/2), (letterBlock.getHeight()/2)+16, EaseBackOut.getInstance()));
    wordBlock.registerEntityModifier(new MoveYModifier(0.5f, -(wordBlock.getHeight()/2), (wordBlock.getHeight()/2)+16, EaseBackOut.getInstance()));
    gameBlock.registerEntityModifier(new MoveYModifier(0.5f, -(gameBlock.getHeight()/2), (gameBlock.getHeight()/2)+16, EaseBackOut.getInstance()));
    decorationBlock.registerEntityModifier(new MoveYModifier(0.5f, -(decorationBlock.getHeight()/2), (decorationBlock.getHeight()/2)+16, EaseBackOut.getInstance()));

    helpButton.registerEntityModifier(new MoveYModifier(0.5f, GameActivity.CAMERA_HEIGHT + 48, GameActivity.CAMERA_HEIGHT-(helpButton.getHeight()/2), EaseBackOut.getInstance()));
    musicButton.registerEntityModifier(new MoveYModifier(0.5f, GameActivity.CAMERA_HEIGHT + 48, GameActivity.CAMERA_HEIGHT-(musicButton.getHeight()/2), EaseBackOut.getInstance()));

    levelIcon.registerEntityModifier(new MoveYModifier(0.5f, GameActivity.CAMERA_HEIGHT + 48, GameActivity.CAMERA_HEIGHT-(levelIcon.getHeight()/2), EaseBackOut.getInstance()));
    //levelDisplay.registerEntityModifier(new MoveYModifier(0.5f, GameActivity.CAMERA_HEIGHT + 48, GameActivity.CAMERA_HEIGHT - 24, EaseBackOut.getInstance()));

    coinIcon.registerEntityModifier(new MoveYModifier(0.5f, GameActivity.CAMERA_HEIGHT - 16, GameActivity.CAMERA_HEIGHT-(coinIcon.getHeight()/2)-64, EaseBackOut.getInstance()));
    //balanceDisplay.registerEntityModifier(new MoveYModifier(0.5f, GameActivity.CAMERA_HEIGHT - 52, GameActivity.CAMERA_HEIGHT - 104, EaseBackOut.getInstance()));

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:22,代码来源:DefaultHUD.java


示例6: pass

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void pass(Word word) {
    //TODO: count success
    Debug.d("wordmatch: pass!");
    GameSounds.play(GameSounds.COMPLETE);
    this.winnings.add(word);
    ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
    Sprite winning_sprite = new Sprite(this.cardPane.getWidth()/2, this.cardPane.getHeight() - 300, sprite_region.getTextureRegion(1), PhoeniciaContext.vboManager);
    winning_sprite.setZIndex(foreground_sprite.getZIndex()+1);
    this.resultsPane.attachChild(winning_sprite);
    winning_sprite.registerEntityModifier(new ParallelEntityModifier(
            new ScaleModifier(0.5f, 2.0f, 1.0f),
            new MoveYModifier(0.5f, 300, 80),
            new MoveXModifier(0.5f, this.resultsPane.getWidth()/2, 40+(this.result_number*80))
            ));
    this.result_number++;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:WordMatchGameHUD.java


示例7: setEmblem

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
public void setEmblem(Sprite emblem) {
    Debug.d("Setting emblem to "+emblem);
    this.emblem = emblem;
    this.emblem.setPosition(this.getWidth()*0.66f, this.getHeight()*0.66f);
    this.emblem.setZIndex(this.getZIndex() + 1);
    this.emblem.setScale(0.33f);
    this.emblem.registerEntityModifier(
            new LoopEntityModifier(
                    new SequenceEntityModifier(
                        new MoveYModifier(1f, this.emblem.getY(), this.emblem.getY() + 5),
                        new MoveYModifier(1f, this.emblem.getY()+5, this.emblem.getY())
                    )
            )
    );
    this.attachChild(emblem);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:MapBlockSprite.java


示例8: addAnimation

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void addAnimation(final int[] currentScore) {

        engine.registerUpdateHandler(new TimerHandler(0.01f, true, new ITimerCallback() {

                    @Override
                    public void onTimePassed(TimerHandler pTimerHandler) {

                        if (!leaveScene) {
                            if (currentScore[0] >= justPlayResult.getScore()) {
                                score.setText(String.valueOf(justPlayResult.getScore()));
                                engine.unregisterUpdateHandler(pTimerHandler);
                            } else {
                                currentScore[0]++;
                                score.setText(String.valueOf(currentScore[0]));
                            }
                        } else {
                            engine.unregisterUpdateHandler(pTimerHandler);
                        }
                    }
                }));
        registerEntityModifier(new MoveYModifier(0.15f, -camera.getHeight(), 0, EaseQuadInOut.getInstance()));
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:23,代码来源:JustPlayLostScene.java


示例9: addAnimation

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void addAnimation(final int[] currentScore) {

        float stepRange = 0.5f / (justPlayResult.getScore() - justPlayResult.getLastScore());
        engine.registerUpdateHandler(new TimerHandler(stepRange, true, new ITimerCallback() {

                    @Override
                    public void onTimePassed(TimerHandler pTimerHandler) {

                        if (!leaveScene) {
                            if (currentScore[0] >= justPlayResult.getScore()) {
                                score.setText(String.valueOf(justPlayResult.getScore()));
                                engine.unregisterUpdateHandler(pTimerHandler);
                            } else {
                                currentScore[0]++;
                                score.setText(String.valueOf(currentScore[0]));
                            }
                        } else {
                            engine.unregisterUpdateHandler(pTimerHandler);
                        }
                    }
                }));
        registerEntityModifier(new MoveYModifier(0.15f, -camera.getHeight(), 0, EaseQuadInOut.getInstance()));
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:24,代码来源:JustPlayScoreScene.java


示例10: collectWord

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
protected void collectWord(final TiledSprite wordSprite, final WordBuilder builder) {
    game.playBlockSound(buildWord.sound);
    Inventory.getInstance().add(builder.item_name.get());
    game.session.addExperience(buildWord.points);
    int builderIndex = this.buildQueue.indexOf(builder);
    Debug.d("Removing queue item at " + builderIndex);
    for (int i = builderIndex+1; i >= 0 && i < this.buildQueue.size(); i++) {
        Debug.d("Moving queue item at "+i);
        WordBuilder nextInQueue = this.buildQueue.get(i);
        TiledSprite nextSprite = this.queueSpriteMap.get(nextInQueue);
        nextSprite.registerEntityModifier(new MoveXModifier(0.5f, nextSprite.getX(), nextSprite.getX()-64));
        Text nextProgress = this.queueProgressMap.get(nextInQueue);
        nextProgress.registerEntityModifier(new MoveXModifier(0.5f, nextProgress.getX(), nextProgress.getX()-64));
    }
    this.queueSpriteMap.remove(builder);
    wordSprite.registerEntityModifier(new ParallelEntityModifier(
            new MoveYModifier(0.5f, wordSprite.getY(), wordSprite.getY() + 128),
            new FadeOutModifier(0.5f)
    ));

    this.unregisterTouchArea(this.queueTouchAreaMap.get(builder));
    this.queueTouchAreaMap.remove(builder);

    this.buildQueue.remove(builder);
    tile.checkAttention();
    builder.delete(PhoeniciaContext.context);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:28,代码来源:WordBuilderHUD.java


示例11: addRequestToQueue

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void addRequestToQueue(final MarketRequest request, final boolean animate) {
    float startX = (this.requestsPane.getWidth()) - (this.columns * 192) + 96;
    float startY = this.requestsPane.getHeight() - 128;

    float column = this.requestPerson.size() % 2;
    float row = (int)(this.requestPerson.size()/2);
    final Person currentPerson = game.locale.person_map.get(request.person_name.get());
    if (currentPerson == null) {
        Debug.d("Market Request without person!");
        return;
    }
    Debug.d("Adding Market request: " + currentPerson.name);
    final ITextureRegion personRegion = game.personTiles.get(currentPerson);

    final ButtonSprite block = new ButtonSprite(startX + (192 * column), startY - (288 * row), personRegion, PhoeniciaContext.vboManager);
    block.setOnClickListener(new ButtonSprite.OnClickListener() {
        @Override
        public void onClick(ButtonSprite buttonSprite, float v, float v2) {
            Debug.d("Request from " + currentPerson.name + " clicked");
            populateRequestItems(request);
        }
    });
    requestsPane.registerTouchArea(block);
    requestsPane.attachChild(block);
    this.requestPerson.put(request, block);

    Text personName = new Text(block.getWidth()/2, -16, GameFonts.dialogText(), currentPerson.name, currentPerson.name.length(),  new TextOptions(AutoWrap.WORDS, 192, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
    block.attachChild(personName);
    this.requestName.put(request, personName);

    this.requestQueue.add(request);
    if (animate) {
        block.registerEntityModifier(new MoveYModifier(0.5f, -(block.getHeight()/2), startY - (288 * row)));
    }

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:37,代码来源:MarketHUD.java


示例12: removeRequestFromQueue

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void removeRequestFromQueue(MarketRequest request) {
    requestItemsPane.detachChildren();
    int requestIndex = this.requestQueue.indexOf(request);
    if (requestIndex < 0) {
        Debug.e("Request for "+request.person_name.get()+" is not in the queue!");
    }
    Sprite personSprite = requestPerson.get(request);
    if (personSprite != null) {
        unregisterTouchArea(personSprite);
        personSprite.detachSelf();
        requestPerson.remove(request);
        this.requestsPane.unregisterTouchArea(personSprite);
    } else {
        Debug.e("No person sprite found for request "+request.person_name.get());
    }

    float startX = (this.requestsPane.getWidth()) - (this.columns * 192) + 96;
    float startY = this.requestsPane.getHeight() - 128;

    Debug.d("Moving requests to the right of " + requestIndex);
    for (int i = requestIndex+1; i < this.requestQueue.size(); i++) {
        float column = (i-1) % 2;
        float row = (int)((i-1)/2);
        MarketRequest nextRequest = this.requestQueue.get(i);
        Sprite nextSprite = this.requestPerson.get(nextRequest);
        nextSprite.registerEntityModifier(new ParallelEntityModifier(
                new MoveXModifier(0.5f, nextSprite.getX(), startX + (192 * column)),
                new MoveYModifier(0.5f, nextSprite.getY(), startY - (288 * row))
        ));
    }
    this.requestQueue.remove(request);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:33,代码来源:MarketHUD.java


示例13: fail

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void fail(Word word) {
    //TODO: count failure
    Debug.d("wordmatch: fail!");
    GameSounds.play(GameSounds.FAILED);
    ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
    Sprite missed_sprite = new Sprite(this.cardPane.getWidth()/2, this.cardPane.getHeight() - 300, sprite_region.getTextureRegion(2), PhoeniciaContext.vboManager);
    this.resultsPane.attachChild(missed_sprite);
    missed_sprite.registerEntityModifier(new ParallelEntityModifier(
            new ScaleModifier(0.5f, 2.0f, 1.0f),
            new MoveYModifier(0.5f, 300, 80),
            new MoveXModifier(0.5f, this.resultsPane.getWidth()/2, 48+(this.result_number*80))
            ));
    this.result_number++;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:15,代码来源:WordMatchGameHUD.java


示例14: show

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
/**
 * Animate the bottom panel sliding up into view.
 */
@Override
public void show() {
    if (placementDone) this.finish();
    whiteRect.registerEntityModifier(new MoveYModifier(0.5f, -125, 125, EaseBackOut.getInstance()));
    letterPanel.registerEntityModifier(new MoveYModifier(0.5f, -125, 125, EaseBackOut.getInstance()));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:10,代码来源:LetterPlacementHUD.java


示例15: show

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
/**
 * Animate the opacity of the sprite being moved
 */
@Override
public void show() {
    this.originalTileIndex = this.sprite.getCurrentTileIndex();
    this.sprite.stopAnimation();
    this.sprite.setCurrentTileIndex(0);
    this.checkPlacement(this.newLocation);
    Debug.d("Sprite placement restriction: "+this.restriction);
    whiteRect.registerEntityModifier(new MoveYModifier(0.5f, -48, 64, EaseBackOut.getInstance()));
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:13,代码来源:SpriteMoveHUD.java


示例16: show

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
public void show(){
    if(!locked) {
        clearEntityModifiers();
        if(!force) {
            showTab();
        }
        this.registerEntityModifier(
                new MoveYModifier(Constants.ANIMATION_DURATION, this.getY(), GameActivity.WORLD_HEIGHT - GameActivity.WORLD_HEIGHT / 3,
                        EaseLinear.getInstance()
                ));
        GameManager.getInstance().hideTabs();
        visible = true;
    }
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:15,代码来源:NoteBookSprite.java


示例17: hide

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
public void hide(){
    if(justShow){
        left.hide();
        right.hide();
    }
    justShow = false;
    if(!locked) {
        hideScoreButtons();
        clearEntityModifiers();
        hideTab();
        this.registerEntityModifier(new MoveYModifier(Constants.ANIMATION_DURATION, this.getY(), GameActivity.WORLD_HEIGHT + this.getHeight() / 2, EaseLinear.getInstance()));
        GameManager.getInstance().showTabs();
        visible = false;
    }
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:16,代码来源:NoteBookSprite.java


示例18: onGameOver

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void onGameOver(){
    for(Ground ground : mPoolManager.getPool(Ground.class).getAvailableItems()){
        ground.clearEntityModifiers();
    }
    mFlappyBird.stopAnimation();
    mFlappyBird.registerEntityModifier(new MoveYModifier(1,mFlappyBird.getY(),mCamera.getHeight()*.75f-mFlappyBird.getHeight()));
}
 
开发者ID:andreiverdes,项目名称:flappybird,代码行数:8,代码来源:GameScene.java


示例19: addWordToQueue

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
protected void addWordToQueue(final WordBuilder builder, final boolean animate) {
    float buildQueueStartX = this.whiteRect.getWidth()/2 - (32*maxQueueSize) + 32;
    float startX = buildQueueStartX + (64 * this.queueSpriteMap.size());
    final ITiledTextureRegion wordSpriteRegion = game.wordSprites.get(tile.word);
    final TiledSprite wordSprite = new TiledSprite(startX, this.whiteRect.getHeight()-48, wordSpriteRegion, PhoeniciaContext.vboManager);
    this.whiteRect.attachChild(wordSprite);
    queueSpriteMap.put(builder, wordSprite);
    final ClickDetector builderClickDetector = new ClickDetector(new ClickDetector.IClickDetectorListener() {
        @Override
        public void onClick(ClickDetector clickDetector, int i, float v, float v1) {
            if (builder.status.get() == Builder.COMPLETE) {
                collectWord(wordSprite, builder);
            }
        }
    });
    Entity clickArea = new Entity(wordSprite.getWidth()/2, wordSprite.getHeight()/2, wordSprite.getWidth(), wordSprite.getHeight()) {
        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
            return builderClickDetector.onManagedTouchEvent(pSceneTouchEvent);
        }
    };
    queueTouchAreaMap.put(builder, clickArea);
    wordSprite.attachChild(clickArea);
    this.registerTouchArea(clickArea);
    if (animate) {
        wordSprite.registerEntityModifier(new MoveYModifier(0.5f, this.buildPane.getY(), this.whiteRect.getHeight()-48));
        wordSprite.registerEntityModifier(new MoveXModifier(0.5f, this.wordSprite.getX(), startX));
    }


    final Text builderProgress = new Text(startX, this.whiteRect.getHeight()-96, GameFonts.inventoryCount(), "", 5, PhoeniciaContext.vboManager);
    this.whiteRect.attachChild(builderProgress);

    queueProgressMap.put(builder, builderProgress);
    builder.addUpdateHandler(this.queueUpdateHandler);

    switch (builder.status.get()) {
        case Builder.SCHEDULED:
            this.queueUpdateHandler.onScheduled(builder);
            break;
        case Builder.BUILDING:
            this.queueUpdateHandler.onStarted(builder);
            break;
        case Builder.COMPLETE:
            this.queueUpdateHandler.onCompleted(builder);
            break;
        default:
            wordSprite.setCurrentTileIndex(3);
    }
    this.queueUpdateHandler.onProgressChanged(builder);

}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:53,代码来源:WordBuilderHUD.java


示例20: addBuildingWord

import org.andengine.entity.modifier.MoveYModifier; //导入依赖的package包/类
private void addBuildingWord(final WorkshopBuilder builder, boolean animate) {
    Debug.d("Preparing to display active builder for: "+this.builder.item_name.get());
    final Word buildWord = game.locale.word_map.get(this.builder.item_name.get());
    final ITiledTextureRegion wordSpriteRegion = game.wordSprites.get(buildWord);
    this.buildSprite = new TiledSprite(whiteRect.getWidth()/2, this.queuePane.getHeight()-48, wordSpriteRegion, PhoeniciaContext.vboManager);
    this.queuePane.attachChild(this.buildSprite);
    final ClickDetector builderClickDetector = new ClickDetector(new ClickDetector.IClickDetectorListener() {
        @Override
        public void onClick(ClickDetector clickDetector, int i, float v, float v1) {
            Debug.d("Activated block: " + builder.getId());
            if (builder.status.get() == Builder.COMPLETE) {
                game.playBlockSound(buildWord.sound);
                Inventory.getInstance().add(builder.item_name.get());
                builder.item_name.set("");
                builder.status.set(Builder.NONE);
                builder.save(PhoeniciaContext.context);
                buildSprite.registerEntityModifier(new ParallelEntityModifier(
                        new MoveYModifier(0.5f, buildSprite.getY(), buildSprite.getY() + 128),
                        new FadeOutModifier(0.5f)
                ));
                tryButton.setVisible(true);
                tile.setAttention(false);
            } else {
                game.playBlockSound(buildWord.sound);
            }
        }
    });
    Entity clickArea = new Entity(buildSprite.getX(), buildSprite.getY(), buildSprite.getWidth(), buildSprite.getHeight()) {
        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
            return builderClickDetector.onManagedTouchEvent(pSceneTouchEvent);
        }
    };
    this.queuePane.attachChild(clickArea);
    this.registerTouchArea(clickArea);


    this.buildProgress = new Text(whiteRect.getWidth()/2, this.queuePane.getHeight()-90, GameFonts.inventoryCount(), "", 5, PhoeniciaContext.vboManager);
    this.queuePane.attachChild(buildProgress);

    builder.addUpdateHandler(this.buildUpdateHandler);

    switch (builder.status.get()) {
        case Builder.SCHEDULED:
            this.buildUpdateHandler.onScheduled(builder);
            break;
        case Builder.BUILDING:
            this.buildUpdateHandler.onStarted(builder);
            break;
        case Builder.COMPLETE:
            this.buildUpdateHandler.onCompleted(builder);
            break;
        default:
            buildSprite.setCurrentTileIndex(3);
    }
    this.buildUpdateHandler.onProgressChanged(builder);

    if (animate) {
        this.buildSprite.registerEntityModifier(
                new ScaleModifier(0.3f, 0.2f, 1.0f)
        );
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:64,代码来源:WorkshopHUD.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WebStorage类代码示例发布时间:2022-05-23
下一篇:
Java IQueryResult类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap