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


Java HorizontalAlign类代码示例

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


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

示例1: showDeleteConfirm

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
public void showDeleteConfirm(final SessionSprite sessionSprite) {
    final Scene scene = this;
    Dialog confirmDelete = new Dialog(400, 200, Dialog.Buttons.YES_NO, PhoeniciaContext.vboManager, new Dialog.DialogListener() {
        @Override
        public void onDialogButtonClicked(Dialog dialog, Dialog.DialogButton dialogButton) {
            if (dialogButton == Dialog.DialogButton.YES) {
                Debug.d("Delete session");
                deleteSession(sessionSprite);
            } else {
                Debug.d("Don't delete session");
            }
            dialog.close();
            scene.unregisterTouchArea(dialog);
        }
    });
    confirmDelete.attachChild(new Text(200, 150, GameFonts.dialogText(), "Delete saved game?", 18, new TextOptions(HorizontalAlign.CENTER), PhoeniciaContext.vboManager));
    scene.registerTouchArea(confirmDelete);
    confirmDelete.open(scene);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:20,代码来源:SessionSelectionScene.java

示例2: show_sorry

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
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,代码行数:20,代码来源:ImageMatchGameHUD.java

示例3: showPage

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
/**
 * 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,代码行数:22,代码来源:LevelIntroHUD.java

示例4: DormidaSprite

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
public DormidaSprite() {
    super(GameActivity.WORLD_WIDTH / 2, GameActivity.WORLD_HEIGHT / 2,
            ResourceManager.getInstance().NOTE_BOOK_EMPTY_TEXTURE_REGION, ResourceManager.getInstance().getVertexBuffer());
    this.setY(GameActivity.WORLD_HEIGHT + this.getHeight() / 2);
    float posY = 100;
    winnerTitle = new Text((this.getWidth()/2)+30,this.getHeight()-posY, ResourceManager.getInstance().fontBig,"123456789",20, new TextOptions(HorizontalAlign.CENTER),ResourceManager.getInstance().getVertexBuffer());
    winnerTitle.setText(ResourceManager.getInstance().context.getString(R.string.dormida));
    winnerTitle.setColor(0.25490196f, 0.25490196f, 0.25490196f);
    winnerTitle.setScale(0.7f);
    this.attachChild(winnerTitle);
    posY += 120;
    winnerPlayer = new Text((this.getWidth()/2)+30,this.getHeight()-posY, ResourceManager.getInstance().fontNormal,"123456789",20, new TextOptions(HorizontalAlign.CENTER),ResourceManager.getInstance().getVertexBuffer());
    this.attachChild(winnerPlayer);
    this.setVisible(false);

}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:17,代码来源:DormidaSprite.java

示例5: getMenuItemX

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
protected float getMenuItemX(final MenuScene pMenuScene, final int pIndex) {
	final float menuSceneWidth = pMenuScene.getWidth();

	final IMenuItem menuItem = pMenuScene.getMenuItem(pIndex);
	final float menuItemWidth = menuItem.getWidth();

	/* Determine horizontal position. */
	final float x;
	switch (this.mHorizontalAlign) {
		case LEFT:
			x = menuItemWidth * 0.5f;
			break;
		case CENTER:
			x = menuSceneWidth * 0.5f;
			break;
		case RIGHT:
			x = menuSceneWidth - (menuItemWidth * 0.5f);
			break;
		default:
			throw new IllegalArgumentException("Unexpected " + HorizontalAlign.class.getSimpleName() + " with value: '" + this.mHorizontalAlign + "'.");
	}

	return x + this.mOffsetX;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:25,代码来源:MenuSceneAnimator.java

示例6: onShowScene

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
@Override
public void onShowScene() {
    // Bg:
    // TODO: background
    getBackground().setColor(0.5f, 0.3f, 0.8f);
    
    //
    // Diff tittle:
    achievTittle = new Text(1540, HEIGHT - 166,
            ResourceManager.getInstance().fontMedium, "Achievements",
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    attachChild(achievTittle);
    
    // Main achievements grid:
    achievementGrid = new AchievementGrid(662, HEIGHT/2, GameManager.getAchievSet());
    attachChild(achievementGrid);
    
    // Achiev detail:
    achievementDetail = new AchievementDetail(1550, HEIGHT - 740);
    attachChild(achievementDetail);
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:23,代码来源:AchievementsScene.java

示例7: addScoreLine

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
/**
 * Adds a new score row to the scroll.
 * @param y The Y position of the score line.
 * @param description The score item description, like "Jump Time", "Shuriken Precission", etc.
 * @param value The item value like "34 sec", or "67%".
 */
private void addScoreLine(float y, String description, String value) {
    Text descriptionText = new Text(WIDTH/2, y,
            ResourceManager.getInstance().fontSmall,
            description,
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    attachChild(descriptionText);
    
    Text valueText = new Text(POS_X_LEFT_SCORE, y,
            ResourceManager.getInstance().fontSmall,
            value,
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    attachChild(valueText);        
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:22,代码来源:ResultWinScene.java

示例8: RecordsTableEntity

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
/**
 * 
 * @param x the tittle x pos
 * @param y the tittle y pos
 * @param tittle the table name
 * @param rt data source
 */
public RecordsTableEntity(float x, float y, String tittle, RecordsTable rt) {
    Text tittleText = new Text(x, y,
            ResourceManager.getInstance().fontMedium,
            tittle,
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    attachChild(tittleText);
    
    for (int i = 0; i < RecordsTableSet.SIZE; i++) {
        RecordItem r = new RecordItem(x, y - 80 - RecordItem.ITEM_HEIGHT * i,
                rt.recordsTable[RecordsTableSet.SIZE-i-1],
                i == 0 ? true : false);
        attachChild(r);
    }
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:23,代码来源:RecordsScene.java

示例9: onShowScene

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
@Override
public void onShowScene() {
    int i = GameManager.getSelectedDiff();
    this.getBackground().setColor(0.5f, 0.3f, 0.2f);
    final Text loadingText = new Text(
            ResourceManager.getInstance().cameraWidth * 0.5f,
            ResourceManager.getInstance().cameraHeight * 0.5f,
            ResourceManager.getInstance().fontMedium,
            "Press O for action\n" +
            "You must wait for " + PUSH_DELAY_TIME + " seconds.\n" +
            "Selected Diff = " + i,
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    this.attachChild(loadingText);

}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:17,代码来源:DummyMenu.java

示例10: onShowScene

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
@Override
public void onShowScene() {
    this.getBackground().setColor(0.9f, 0.2f, 0.9f);

    tittleText = new Text(WIDTH/2, HEIGHT - 200,
            ResourceManager.getInstance().fontMedium, "Clear Data Scene",
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    attachChild(tittleText);
    
    // SelectionStripe:
    selectionStripe = new SelectionStripe(tittleText.getX(), tittleText.getY() - 400, 
            SelectionStripe.DISP_VERTICAL, 200f,
            new String[] {"Clean Records", "Clean Achievements"}, 
            SelectionStripe.TEXT_ALIGN_CENTER, 0);
    attachChild(selectionStripe);
    
    c = ResourceManager.getInstance().context;
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:20,代码来源:DataLoadAndSaveTestScene.java

示例11: createHUD

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
private void createHUD() {
	mHUD = new HUD(); // create fixed HUD for static text display
	
	mTimeText = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_TIME), new TextOptions(HorizontalAlign.LEFT), mVertexManager); // prepare memory with all possible chars
	mExclamation = new Text(0, 0, mResourcesManager.mFontBig, Phrases.getPossibleCharacters(Phrases.FIELD_EXCLAMATION), new TextOptions(HorizontalAlign.CENTER), mVertexManager); // prepare memory with all possible chars
	mScoreText = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_SCORE), new TextOptions(HorizontalAlign.RIGHT), mVertexManager); // prepare memory with all possible chars
	mBottomText = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_TAP_TO_LEAVE), new TextOptions(HorizontalAlign.CENTER), mVertexManager); // prepare memory with all possible chars
	updateScore();
	updateExclamation();
	updateText(mBottomText, Phrases.mEmpty, GameScreen.CAMERA_WIDTH/2, GameScreen.CAMERA_HEIGHT/3, TEXT_HALIGN_CENTER, TEXT_VALIGN_TOP);
	
	mHUD.attachChild(mTimeText);
	mHUD.attachChild(mExclamation);
	mHUD.attachChild(mScoreText);
	mHUD.attachChild(mBottomText);

	mCamera.setHUD(mHUD);
}
 
开发者ID:delight-im,项目名称:NationSoccer,代码行数:19,代码来源:GameScene.java

示例12: showMessage

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
public void showMessage(Message message, MessageBox position, final boolean showNextButton, final MediaPlayer.OnCompletionListener listener) {
    String messageText = message.text;
    String messageSound = message.sound;

    this.messageBox.detachChildren();
    this.nextButton.setVisible(false);
    this.messageBox.attachChild(this.nextButton);

    this.positionMessageBox(position);
    this.displayText = new Text(this.messageBox.getWidth()/2+16, this.messageBox.getHeight()/2, GameFonts.introText(), messageText, messageText.length(), new TextOptions(HorizontalAlign.LEFT), PhoeniciaContext.vboManager);
    this.displayText.setAutoWrapWidth(this.messageBox.getWidth() - 32);
    this.displayText.setAutoWrap(AutoWrap.WORDS);

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

    this.messageBox.attachChild(this.displayText);
    if (messageSound != null && messageSound.length() > 0) {
        Debug.d("Playing tour message sound: '" + messageSound + "'");
        this.messagePlaying = true;
        this.game.playLevelSound(messageSound, new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                messagePlaying = false;
                if (listener != null) {
                    listener.onCompletion(mp);
                }
                if (showNextButton) {
                    nextButton.setVisible(true);
                }
            }
        });
    }


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

示例13: show_reward

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
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,代码行数:41,代码来源:ImageMatchGameHUD.java

示例14: addRequestToQueue

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的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

示例15: WordSprite

import org.andengine.util.adt.align.HorizontalAlign; //导入依赖的package包/类
/**
 * Construct a new LetterSprite
 * @param pX the X coordinate of the scene to place this LetterSprite
 * @param pY the Y coordinate of the scene to place this LetterSprite
 * @param word the locale Word this sprite will represent
 * @param count how many you have
 * @param needed how many you need
 * @param region the ITextureRegion containing the tiles for this letter
 * @param vbo the game's VertexBufferObjectManager
 */
public WordSprite(float pX, float pY, Word word, int count, int needed, ITiledTextureRegion region, VertexBufferObjectManager vbo) {
    super(pX, pY, region, vbo);
    this.word = word;
    this.count = count;
    this.needed = needed;

    this.count_text = new Text(32, -10, GameFonts.inventoryCount(), "", 8, new TextOptions(HorizontalAlign.CENTER), vbo);
    this.setCount(count);
    this.attachChild(count_text);

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


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