本文整理汇总了Java中org.andengine.entity.primitive.Rectangle.attachChild方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.attachChild方法的具体用法?Java Rectangle.attachChild怎么用?Java Rectangle.attachChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.primitive.Rectangle
的用法示例。
在下文中一共展示了Rectangle.attachChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initInfoMessageText
import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
* 戦闘ログテキスト初期化
*/
private void initInfoMessageText(IEntity entity) {
float width = getBaseScene().getWindowWidth() - (getBaseScene().getWindowWidth() / 10);
float height = 40;
Rectangle rectangle = getBaseScene().createRectangle(0, 0, width, height);
rectangle.setColor(Color.BLACK);
rectangle.setAlpha(0.5f);
rectangle.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
rectangle.setTag(INFO_MESSAGE_TEXT_TAG);
Text text = new Text(10, 10, getBaseScene().createFont(Typeface.DEFAULT, 20, Color.WHITE),
"000000000000000000000000000000000000000000000000000000000000000",
getBaseScene().getBaseActivity().getVertexBufferObjectManager());
rectangle.attachChild(text);
getBaseScene().placeToCenterX(rectangle, 10);
rectangle.setVisible(false);
entity.attachChild(rectangle);
}
示例2: createTextRectangle
import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public Rectangle createTextRectangle(String titleStr, Font titleFont, String detatilStr, Font detailFont,
VertexBufferObjectManager pVertexBufferObjectManager) {
Text titleText = new Text(0, 0, titleFont, titleStr,
pVertexBufferObjectManager);
Text detatilText = new Text(0, 0, detailFont, detatilStr,
pVertexBufferObjectManager);
titleText.setPosition(0, 0);
detatilText.setPosition(titleText.getX() + titleText.getWidth(), titleText.getY());
float textWidth = titleText.getWidth() + detatilText.getWidth();
float textHeight = titleText.getHeight();
Rectangle resultRectangle = new Rectangle(0, 0, textWidth, textHeight,
pVertexBufferObjectManager);
resultRectangle.setColor(Color.TRANSPARENT);
resultRectangle.setAlpha(0.0f);
resultRectangle.attachChild(titleText);
resultRectangle.attachChild(detatilText);
return resultRectangle;
}
示例3: inputNumber
import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public void inputNumber(Number n) {
if (inputCursor >= CODE_LENGTH) return;
requestCode += n.intval * (Math.pow(10, CODE_LENGTH-inputCursor-1));
Rectangle inputBox = inputLocations[inputCursor];
Sprite inputChar = new Sprite(inputBox.getWidth()/2, inputBox.getHeight()/2, game.numberSprites.get(n), PhoeniciaContext.vboManager);
inputBox.attachChild(inputChar);
inputCursor++;
}
示例4: inputNumber
import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public void inputNumber(Number n) {
if (inputCursor >= CODE_LENGTH) return;
responseCode += n.intval * (Math.pow(10, CODE_LENGTH-inputCursor-1));
Rectangle inputBox = inputLocations[inputCursor];
Sprite inputChar = new Sprite(inputBox.getWidth()/2, inputBox.getHeight()/2, game.numberSprites.get(n), PhoeniciaContext.vboManager);
inputBox.attachChild(inputChar);
inputCursor++;
}
示例5: init
import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public void init(ActorPlayerDto player, ActorPlayerDto enemy, BattleInitType pBattleInitType) {
Log.d("BattlePart", player.toString());
Log.d("BattlePart", enemy.toString());
changeState(BattleStateType.INIT);
mBattleInitType = pBattleInitType;
mPlayerList = new ArrayList<ActorPlayerDto>();
mEnemyList = new ArrayList<ActorPlayerDto>();
mPlayerList.add(player);
mEnemyList.add(enemy);
// 上に重ねる用にBaseを用意
mBaseLayer = new Rectangle(0, 0,
getBaseScene().getWindowWidth(), getBaseScene().getWindowHeight(),
getBaseScene().getBaseActivity().getVertexBufferObjectManager());
mBaseLayer.setColor(Color.TRANSPARENT);
initDamageText(mBaseLayer);
initInfoMessageText(mBaseLayer);
// 背景表示
initBackground();
// 背景画像の都合で表示位置が決まる
float acotrBaseY = getBaseScene().getWindowHeight() / 2;
// キャラ表示
ActorBattleSprite playerSprite = new ActorBattleSprite(player, getBaseScene(), 0, 0, 64, 64);
playerSprite.setSize(64, 64);
playerSprite.setTag(player.getPlayerId());
// 右上から表示
playerSprite.setPosition(getBaseScene().getWindowWidth() -
(getBaseScene().getWindowWidth() / 8) -
playerSprite.getWidth(),
acotrBaseY);
mBaseLayer.attachChild(playerSprite);
// キャラ表示
ActorBattleSprite enemySprite = new ActorBattleSprite(enemy, getBaseScene(), 0, 0, 64, 64);
enemySprite.setSize(64, 64);
enemySprite.setTag(enemy.getPlayerId());
// 左上から表示
enemySprite.setPosition(getBaseScene().getWindowWidth() / 8,
acotrBaseY);
mBaseLayer.attachChild(enemySprite);
// 攻撃エフェクトを用意
// TODO: ファイル固定にしているけど、wewaponImgResIdでから引っ張れるようにする
AnimatedSprite playerAttackEffectSprite = getBaseScene().getResourceAnimatedSprite(
"effect/rapier.png", 5, 4);
playerAttackEffectSprite.setVisible(false);
playerAttackEffectSprite.setTag(ACTOR_ATTACK_EFFETC_TAG + player.getEquipDto().getWeaponImgResId());
mBaseLayer.attachChild(playerAttackEffectSprite);
AnimatedSprite enemyAttackEffectSprite = getBaseScene().getResourceAnimatedSprite(
"effect/shock.png", 5, 2);
enemyAttackEffectSprite.setVisible(false);
enemyAttackEffectSprite.setColor(Color.YELLOW);
enemyAttackEffectSprite.setTag(ACTOR_ATTACK_EFFETC_TAG + enemy.getEquipDto().getWeaponImgResId());
mBaseLayer.attachChild(enemyAttackEffectSprite);
// ベースレイヤをattach
getBaseScene().attachChild(mBaseLayer);
mBaseLayer.sortChildren();
changeState(BattleStateType.START);
}