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


Java AutoWrap.WORDS属性代码示例

本文整理汇总了Java中org.andengine.entity.text.AutoWrap.WORDS属性的典型用法代码示例。如果您正苦于以下问题:Java AutoWrap.WORDS属性的具体用法?Java AutoWrap.WORDS怎么用?Java AutoWrap.WORDS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.andengine.entity.text.AutoWrap的用法示例。


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

示例1: show_sorry

private void show_sorry() {
    Dialog sorry_dialog = new Dialog(400, 150, Dialog.Buttons.OK, PhoeniciaContext.vboManager, new Dialog.DialogListener() {
        @Override
        public void onDialogButtonClicked(Dialog dialog, Dialog.DialogButton dialogButton) {
            dialog.close();
            unregisterTouchArea(dialog);
            finish();
        }
    });
    String counts = String.format("%1$d/%2$d", this.winnings.size(), this.max_rounds);
    Text sorry_text = new Text(sorry_dialog.getWidth()/2, sorry_dialog.getHeight()-48, GameFonts.dialogText(), counts, counts.length(),  new TextOptions(AutoWrap.WORDS, sorry_dialog.getWidth()*0.8f, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
    sorry_text.setColor(Color.RED);
    sorry_dialog.attachChild(sorry_text);

    this.registerTouchArea(sorry_dialog);

    sorry_dialog.open(this);
    GameSounds.play(GameSounds.FAILED);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:19,代码来源:ImageMatchGameHUD.java

示例2: showPage

/**
 * Change the display to the specified IntroPage
 * @param page_index page to display
 */
private void showPage(int page_index) {
    Debug.d("Showing page: "+page_index);
    this.current_page = page_index;
    final String nextPage = level.intro.get(page_index).text;
    final TextOptions introTextOptions = new TextOptions(AutoWrap.WORDS, messageBox.getWidth()-64, HorizontalAlign.LEFT);
    final Text introPageText = new Text(messageBox.getWidth()/2 - 32, messageBox.getHeight()/2, GameFonts.introText(), nextPage, introTextOptions, PhoeniciaContext.vboManager);
    introPageText.setPosition(messageBox.getWidth() / 2, messageBox.getHeight() - (introPageText.getHeight() / 2));

    this.messageBox.setHeight(introPageText.getHeight() + 64);
    introPageText.setPosition(this.messageBox.getWidth() / 2 + 16, this.messageBox.getHeight() - (introPageText.getHeight() / 2));

    messageBox.detachChildren();
    messageBox.attachChild(introPageText);
    messageBox.attachChild(this.nextButton);

    game.playLevelSound(level.intro.get(page_index).sound, this);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:21,代码来源:LevelIntroHUD.java

示例3: show_reward

private void show_reward() {
    Collections.shuffle(this.winnings);
    final Word reward_word = this.winnings.get(0);
    final int reward_coins = Math.round(reward_word.sell * this.tile.game.reward);
    final int reward_points = Math.round(reward_word.points * this.tile.game.reward);

    final Dialog reward_dialog = new Dialog(400, 300, Dialog.Buttons.OK, PhoeniciaContext.vboManager, new Dialog.DialogListener() {
        @Override
        public void onDialogButtonClicked(Dialog dialog, Dialog.DialogButton dialogButton) {
            finish();
            Inventory.getInstance().add(reward_word.name, 1, false);
            Bank.getInstance().credit(reward_coins);
            game.session.addExperience(reward_points);
            GameSounds.play(GameSounds.COLLECT);
            dialog.close();
            unregisterTouchArea(dialog);
        }
    });

    String counts = String.format("%1$d/%2$d", this.winnings.size(), this.max_rounds);
    Text reward_text = new Text(reward_dialog.getWidth()/2, reward_dialog.getHeight()-24, GameFonts.dialogText(), counts, counts.length(),  new TextOptions(AutoWrap.WORDS, reward_dialog.getWidth()*0.8f, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
    reward_text.setColor(Color.GREEN);
    reward_dialog.attachChild(reward_text);

    ITiledTextureRegion sprite_region = this.game.wordSprites.get(reward_word);
    Sprite reward_sprite = new Sprite(reward_dialog.getWidth()/2, reward_dialog.getHeight() - 100, sprite_region.getTextureRegion(1), PhoeniciaContext.vboManager);
    reward_dialog.attachChild(reward_sprite);

    ITextureRegion coinRegion = GameUI.getInstance().getCoinsIcon();
    Sprite coinIcon = new Sprite(reward_dialog.getWidth()/2 - 32, 112, coinRegion, PhoeniciaContext.vboManager);
    coinIcon.setScale(0.5f);
    reward_dialog.attachChild(coinIcon);

    Text iconDisplay = new Text(reward_dialog.getWidth()/2 + 32, 112, GameFonts.dialogText(), String.valueOf(reward_coins), 10, new TextOptions(HorizontalAlign.LEFT), PhoeniciaContext.vboManager);
    reward_dialog.attachChild(iconDisplay);

    this.registerTouchArea(reward_dialog);
    reward_dialog.open(this);
    GameSounds.play(GameSounds.COMPLETE);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:40,代码来源:ImageMatchGameHUD.java

示例4: addRequestToQueue

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,代码行数:36,代码来源:MarketHUD.java

示例5: generatePowerUp

/**
 * Generate a power up that can be collected by shooting it.
 * @param x the x pos
 * @param y the y pos
 * @return the generated power up
 */
public Entity generatePowerUp(float centerX, float centerY, PowerUpTypeEnum type) {
	final Sprite sPowerUp = new Sprite(0, 0, spriteLoader.getPowerUpTextureRegion(), this.vertextBufferObjectManager);
	sPowerUp.setZIndex(9);
	SpriteUtil.setCenter(sPowerUp, centerX, centerY);
	Entity powerUp = this.em.createEntity();
	this.em.addComponentToEntity(new SpriteComponent(sPowerUp, false), powerUp);
	
	Text puText = new Text(0, 0, spriteLoader.getPowerUpFont(), "azertyuiop azertyuiop azertyuiop", new TextOptions(AutoWrap.WORDS, 74, HorizontalAlign.CENTER), this.vertextBufferObjectManager);
	puText.setPosition(43 - puText.getWidth()/2f, 43 - puText.getHeight()/2f);

	sPowerUp.attachChild(puText);
	this.em.addComponentToEntity(new PowerUpComponent(type, 4, puText), powerUp);
	return powerUp;
}
 
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:20,代码来源:EntityFactory.java

示例6: SessionSprite

public SessionSprite(float px, float py, GameSession session, VertexBufferObjectManager vbo) {
    super(px, py, PhoeniciaGame.PERSON_TILE_WIDTH, PhoeniciaGame.PERSON_TILE_HEIGHT+32);
    Debug.d("Adding SessionSprite as "+px+","+py);
    this.session = session;
    if (session.session_name.get() == null) {
        Debug.d("Session has no name, setting it to Player " + (sessionSprites.size() + 1));
        session.session_name.set("Player "+(sessionSprites.size()+1));
        //session.session_name.set("Mchezaji"+(sessionSprites.size()+1));
        session.save(PhoeniciaContext.context);
    }
    Debug.i("Adding Game session: " + session.session_name.get() + " in " + session.locale_pack.get());
    LocaleLoader localeLoader = new LocaleLoader();
    Locale session_locale;
    try {
        session_locale = localeLoader.load(PhoeniciaContext.assetManager.open(session.locale_pack.get()));
        Person currentPerson = session_locale.person_map.get(session.person_name.get());
        if (currentPerson == null) {
            Debug.w("Game Session without person!");
            // TODO: use an "unknown user" image instead
            int person_index = sessionSprites.size() % session_locale.people.size();
            currentPerson = session_locale.people.get(person_index);
            session.person_name.set(currentPerson.name);
            session.save(PhoeniciaContext.context);
        }
        AssetBitmapTexture texture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, currentPerson.texture_src);
        texture.load();
        ITextureRegion personRegion = TextureRegionFactory.extractFromTexture(texture, 0, 0, game.PERSON_TILE_WIDTH, game.PERSON_TILE_HEIGHT);

        block = new ButtonSprite(this.getWidth()/2, py, personRegion, PhoeniciaContext.vboManager);

        personName = new Text(block.getWidth()/2, -16, GameFonts.dialogText(), session.session_name.get(), session.session_name.get().length(),  new TextOptions(AutoWrap.WORDS, 256, HorizontalAlign.CENTER), PhoeniciaContext.vboManager);
        //block.attachChild(personName);

        Texture newShell = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, session_locale.shell_src);
        newShell.load();
        final int GU = 96;
        ITextureRegion levelRegion = TextureRegionFactory.extractFromTexture(newShell, GU*5, GU*0, GU*3, GU*1);
        final ButtonSprite levelIcon = new ButtonSprite(block.getWidth()/2, (0 - levelRegion.getHeight()/2), levelRegion, PhoeniciaContext.vboManager);
        String current_level = session.current_level.get();
        if (current_level == null) current_level = "0";
        final Text levelName = new Text(160, levelIcon.getHeight()/2, GameFonts.defaultHUDDisplay(), current_level, 4, PhoeniciaContext.vboManager);
        levelIcon.attachChild(levelName);
        block.attachChild(levelIcon);

        this.attachChild(block);

    } catch (final IOException e) {
        Debug.e("Failed to load game session person!", e);
    }

    clickDetector = new ClickDetector(this);
    holdDetector = new HoldDetector(this);
    holdDetector.setTriggerHoldMinimumMilliseconds(2000);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:54,代码来源:SessionSelectionScene.java


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