本文整理汇总了Java中org.andengine.entity.text.Text.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setColor方法的具体用法?Java Text.setColor怎么用?Java Text.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.text.Text
的用法示例。
在下文中一共展示了Text.setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show_sorry
import org.andengine.entity.text.Text; //导入方法依赖的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);
}
示例2: DormidaSprite
import org.andengine.entity.text.Text; //导入方法依赖的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);
}
示例3: PriceSign
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public PriceSign(float x, float y, float price, VertexBufferObjectManager pVertexBufferObjectManager) {
// superconstructor
super((int) x - TEXTURE.getWidth() / 2, (int) y - TEXTURE.getHeight() / 2, TEXTURE, pVertexBufferObjectManager);
// set variables
setZIndex(TowerDefense.ZINDEX_HUD);
mPrice = price;
mCenterX = (int) x;
mCenterY = (int) y;
//create text field with price
mPriceText = new Text(mCenterX, mCenterY - 5, TowerDefense.FONT_SMALL, "" + (int) mPrice, 3, getVertexBufferObjectManager());
mPriceText.setZIndex(TowerDefense.ZINDEX_HUD + 1);
mPriceText.setPosition(mCenterX - mPriceText.getWidth() / 2, mCenterY - 5);
if (TowerDefense.mSceneManager.getCurrentLevel().mCoins < mPrice) mPriceText.setColor(0.8f, 0.2f, 0.2f);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mPriceText);
}
示例4: addTexts
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
private void addTexts(int[] currentScore) {
Text levelCompleteTextShape = new Text((float) (camera.getWidth() * 0.12), (float) (camera.getHeight() * 0.1),
resourcesManager.levelCompleteFont, getHeadText(), 20, vbom);
attachChild(levelCompleteTextShape);
Text scoreText = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.45),
resourcesManager.justPlayScoreFont, "Score: ", vbom);
scoreText.setColor(BLACK);
attachChild(scoreText);
score = new Text((float) (camera.getWidth() * 0.65), (float) (camera.getHeight() * 0.45),
resourcesManager.justPlayScoreFont, "" + currentScore[0], 8, vbom);
score.setColor(BLACK);
attachChild(score);
Text timeText = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.605),
resourcesManager.justPlayScoreFont,
"Left Time: \t" + justPlayResult.getLeftTime() + "\n"
+ "Extra Time:\t+" + justPlayResult.getExtraTime(), vbom);
timeText.setColor(WHITE);
attachChild(timeText);
}
示例5: initTalk
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public void initTalk(SparseArray<TiledSprite> faces, List<PlayerTalkDto> talks) {
// 初期化
this.talkIndex = 0;
this.textMaxLength = 0;
// 会話する顔を登録
this.faces = faces;
// 会話内容を登録
this.talks = talks;
// 設定された会話内容を元に最大テキストサイズで初期化してTextを用意する
textMaxLength = getMaxLength(talks);
talkText = new Text(16, 16, font,
getSizeToStr("-", textMaxLength),
new TextOptions(HorizontalAlign.LEFT),
baseScene.getBaseActivity().getVertexBufferObjectManager());
talkText.setAutoWrap(AutoWrap.WORDS);
nameText = new Text(16, 16, font,
getSizeToStr("-", textMaxLength),
new TextOptions(HorizontalAlign.LEFT),
baseScene.getBaseActivity().getVertexBufferObjectManager());
nameText.setColor(Color.GREEN);
nextTalk();
}
示例6: show_reward
import org.andengine.entity.text.Text; //导入方法依赖的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);
}
示例7: ButtonScoreSprite
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public ButtonScoreSprite(float pX, float pY, ITiledTextureRegion pTextureRegion) {
super(pX, pY, pTextureRegion, ResourceManager.getInstance().getVertexBuffer());
text = new Text(this.getWidth()/2,this.getHeight()/2, ResourceManager.getInstance().fontBig,"123456789",10, ResourceManager.getInstance().getVertexBuffer());
text.setText("");
text.setColor(Color.BLACK);
this.attachChild(text);
}
示例8: addTexts
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
private void addTexts(int[] currentScore) {
if (isNewHighscore) {
Text newHighscoreText = new Text((float) (camera.getWidth() * 0.12), (float) (camera.getHeight() * 0.1),
resourcesManager.levelCompleteFont, " New\nHighscore", 20, vbom);
attachChild(newHighscoreText);
} else {
Text levelCompleteTextShape = new Text((float) (camera.getWidth() * 0.12),
(float) (camera.getHeight() * 0.1), resourcesManager.levelCompleteFont, " Game\n Over", 20,
vbom);
attachChild(levelCompleteTextShape);
levelCompleteTextShape.setScaleCenter(levelCompleteTextShape.getWidth() / 2,
levelCompleteTextShape.getHeight() / 2);
levelCompleteTextShape.setScale(1.3f);
}
Text scoreText = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.45),
resourcesManager.justPlayScoreFont, "Score: ", vbom);
scoreText.setColor(BLACK);
attachChild(scoreText);
score = new Text((float) (camera.getWidth() * 0.6), (float) (camera.getHeight() * 0.45),
resourcesManager.justPlayScoreFont, "" + currentScore[0], 8, vbom);
score.setColor(BLACK);
attachChild(score);
Text level = new Text(scoreText.getX(), scoreText.getY() + textFieldHeight, resourcesManager.justPlayScoreFont,
"Level: " + justPlayResult.getLevelCount(), vbom);
level.setColor(BLACK);
attachChild(level);
JustPlayScore justPlayHighscore = justPlayScoreService.getHighscore();
if (justPlayHighscore != null) {
Text highScore = new Text(scoreText.getX(), score.getY() + textFieldHeight * 2,
resourcesManager.justPlayScoreFont, "Highscore:\t" + justPlayHighscore.getPoints(), vbom);
highScore.setColor(BLACK);
attachChild(highScore);
}
}
示例9: initDamageText
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
/**
* ダメージテキスト初期化
*/
private void initDamageText(IEntity entity) {
Text damageText = new Text(0, 0, getBaseScene().getFont(), "00000",
getBaseScene().getBaseActivity().getVertexBufferObjectManager());
damageText.setColor(Color.TRANSPARENT);
damageText.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
damageText.setTag(DAMAGE_TEXT_TAG);
entity.attachChild(damageText);
}
示例10: initDamageText
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
/**
* ダメージテキスト初期化
*/
private void initDamageText(IEntity entity) {
Text damageText = new Text(0, 0, getBaseScene().getFont(), "00000",
getBaseScene().getBaseActivity().getVertexBufferObjectManager());
damageText.setColor(Color.TRANSPARENT);
damageText.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
damageText.setTag(DAMAGE_TEXT_TAG); //TODO: TAG管理
entity.attachChild(damageText);
}
示例11: TestGridItem
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public TestGridItem(String name) {
itemName = name;
itemText = new Text(
0, 0,
ResourceManager.getInstance().fontSmall,
name,
new TextOptions(HorizontalAlign.CENTER),
ResourceManager.getInstance().engine.getVertexBufferObjectManager());
itemText.setColor(android.graphics.Color.BLUE);
attachChild(itemText);
}
示例12: createIntro
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
private void createIntro() {
mIntro = new HUD(); // create fixed HUD for tutorial display
mIntro_Text = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_TAP_TO_START), new TextOptions(HorizontalAlign.CENTER), mVertexManager); // prepare memory with all possible chars
mIntro_Text.setColor(1.0f, 1.0f, 1.0f);
updateText(mIntro_Text, Phrases.mTapToStart, GameScreen.CAMERA_WIDTH/2, GameScreen.CAMERA_HEIGHT/3, TEXT_HALIGN_CENTER, TEXT_VALIGN_TOP);
mIntro.attachChild(mIntro_Text);
mCamera.setHUD(mIntro);
setOnSceneTouchListener(this);
}
示例13: initViews
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public void initViews(final ResourceManager pResourceManager, final Camera pCamera) {
final float cameraHeight = pCamera.getHeight();
final float cameraWidth = pCamera.getWidth();
mRacer = new Racer(GameActivity.NUM_OF_LIVES, cameraWidth, cameraHeight, pResourceManager.mRaceCarRegion, mContext.getVertexBufferObjectManager());
mRacer.setY(cameraHeight - mRacer.getHeight() - 15f);
final int textOffsetX = (int) (cameraWidth * RACE_TRACK_WIDTH) + 20;
// scores
mHighScore = new Text(textOffsetX, 100, pResourceManager.mGameFont, "High Score\n 0123456789", new TextOptions(HorizontalAlign.LEFT), mContext.getVertexBufferObjectManager());
mHighScore.setText("High Score \n " + Persistance.getHighScore(mContext));
mScore = new Text(textOffsetX, 180, pResourceManager.mGameFont, "Score \n0123456789", mContext.getVertexBufferObjectManager());
mLives = new Text(textOffsetX, 260, pResourceManager.mGameFont, "Lives \n01234556789", mContext.getVertexBufferObjectManager());
mLives.setText("Lives \n " + mRacer.mLivesLeft);
mLevel = new Text(textOffsetX, 340, pResourceManager.mGameFont, "Level\n 0123456789", mContext.getVertexBufferObjectManager());
mScore.setText("Score \n 0");
// menus
mPlayText = new Text(cameraWidth / 2, cameraHeight / 3, pResourceManager.mGamePlayFont, "Play", 5, new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
mLevelText = new Text(cameraWidth / 2, cameraHeight / 3 + mPlayText.getHeight() + 40f, pResourceManager.mGamePlayFont, "Level", 5, new TextOptions(HorizontalAlign.CENTER),
mContext.getVertexBufferObjectManager());
mHelpText = new Text(cameraWidth / 2, cameraHeight / 3 + mLevelText.getHeight() + mPlayText.getHeight() + 80f, pResourceManager.mGamePlayFont, "Help", 4, new TextOptions(
HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
// game over
mExplosionSprite = new Sprite(-500f, mRacer.getY(), pResourceManager.mExplosionRegion, mContext.getVertexBufferObjectManager());
mGameOverText = new Text(cameraWidth / 2, cameraHeight / 3, pResourceManager.mGamePlayFont, "Score", 5, new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
mGameOverScoreText = new Text(cameraWidth / 2, cameraHeight / 3 + mGameOverText.getHeight() + 40, pResourceManager.mGamePlayFont, " 0123456789", 12, new TextOptions(HorizontalAlign.CENTER),
mContext.getVertexBufferObjectManager());
mExplosionSprite.setCullingEnabled(true);
mExplosionSprite.setZIndex(3);
mPlayText.setAlpha(0.7f);
mHelpText.setAlpha(0.7f);
mLevelText.setAlpha(0.7f);
mGameOverText.setAlpha(0.7f);
mGameOverScoreText.setAlpha(0.7f);
mGameOverText.setColor(mGameOverTextColor);
mGameOverScoreText.setColor(mGameOverTextColor);
mPlayText.setZIndex(6);
mLevelText.setZIndex(6);
mHelpText.setZIndex(6);
mGameOverText.setZIndex(7);
mGameOverScoreText.setZIndex(7);
placeCenter(mPlayText, pCamera);
placeCenter(mHelpText, pCamera);
placeCenter(mLevelText, pCamera);
placeCenter(mGameOverText, pCamera);
placeCenter(mGameOverScoreText, pCamera);
registerTouchArea(mHelpText);
registerTouchArea(mPlayText);
registerTouchArea(mLevelText);
attachChild(mHelpText);
attachChild(mPlayText);
attachChild(mLevelText);
attachChild(mHighScore);
attachChild(mScore);
attachChild(mLives);
attachChild(mLevel);
attachChild(mRacer);
attachChild(mExplosionSprite);
sortChildren();
}
示例14: setFontColor
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public void setFontColor(Color pColor) {
for (Text text : mTextList) {
text.setColor(pColor);
}
}
示例15: onShowScene
import org.andengine.entity.text.Text; //导入方法依赖的package包/类
@Override
public void onShowScene() {
// Background:
bg = new SpriteBackground(new Sprite(WIDTH * 0.5f, HEIGHT * 0.5f,
ResourceManager.getInstance().loseBg,
ResourceManager.getInstance().engine.getVertexBufferObjectManager()));
setBackground(bg);
// Continue?
continueText = new Text(WIDTH - 400, HEIGHT - 200,
ResourceManager.getInstance().fontBig, ResourceManager.getInstance().loadAndroidRes().getString(R.string.result_lose_continue),
new TextOptions(HorizontalAlign.CENTER),
ResourceManager.getInstance().engine.getVertexBufferObjectManager());
attachChild(continueText);
// Countdown
countdownText = new Text(continueText.getX(), continueText.getY() - 400,
ResourceManager.getInstance().fontXBig, "10",
new TextOptions(HorizontalAlign.CENTER),
ResourceManager.getInstance().engine.getVertexBufferObjectManager());
attachChild(countdownText);
// You Lost
youLostText = new Text(400, 300,
ResourceManager.getInstance().fontBig, ResourceManager.getInstance().loadAndroidRes().getString(R.string.result_lose_you_lost),
new TextOptions(HorizontalAlign.CENTER),
ResourceManager.getInstance().engine.getVertexBufferObjectManager());
youLostText.setColor(android.graphics.Color.YELLOW);
attachChild(youLostText);
// SelectionStripe:
selectionStripe = new SelectionStripe(continueText.getX(), continueText.getY() - 200,
SelectionStripe.DISP_HORIZONTAL, 200f,
new String[] {ResourceManager.getInstance().loadAndroidRes().getString(R.string.result_lose_yes),
ResourceManager.getInstance().loadAndroidRes().getString(R.string.result_lose_no)},
SelectionStripe.TEXT_ALIGN_CENTER, 0);
attachChild(selectionStripe);
// Character:
if(GameManager.getSelectedCharacter() ==
GameManager.CHAR_SHO) {
characterSprite = new Sprite(youLostText.getX(), youLostText.getY() + 300,
ResourceManager.getInstance().loseCharSho,
ResourceManager.getInstance().engine.getVertexBufferObjectManager());
}
else {
characterSprite = new Sprite(youLostText.getX(), youLostText.getY() + 300,
ResourceManager.getInstance().loseCharRyoko,
ResourceManager.getInstance().engine.getVertexBufferObjectManager());
}
attachChild(characterSprite);
// Music:
SFXManager.playMusic(ResourceManager.getInstance().loseMusic);
SFXManager.playSound(ResourceManager.getInstance().loseYouLose);
if(GameManager.getLives() > 0)
countdown();
else
gameOver();
}