本文整理汇总了Java中org.andengine.engine.handler.timer.TimerHandler类的典型用法代码示例。如果您正苦于以下问题:Java TimerHandler类的具体用法?Java TimerHandler怎么用?Java TimerHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimerHandler类属于org.andengine.engine.handler.timer包,在下文中一共展示了TimerHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: score
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
private void score() {
mScoreText.setScale(2f);
mScore += PIPE_PASSING_SCORE[ CURRENT_LEVEL ] ;
mScorePipeSound.play();
updateScore();
mTimer = new TimerHandler(0.5f, false, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
mScoreText.reset();
mScene.unregisterUpdateHandler(mTimer);
}
});
mScene.registerUpdateHandler(mTimer);
}
示例2: scoreBaap
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
private void scoreBaap() {
mScoreText.setScale(2f);
mScore += COIN_POINT[CURRENT_LEVEL];
mScoreCoinSound.play();
updateScore();
mTimer = new TimerHandler(0.5f, false, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
mScoreText.reset();
mScene.unregisterUpdateHandler(mTimer);
}
});
mScene.registerUpdateHandler(mTimer);
}
示例3: dead
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
private void dead() {
GAME_STATE = STATE_DEAD;
mTimer = new TimerHandler(1.6f, false, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
mYouSuckText.reset();
mScene.detachChild(mYouSuckText);
restartGame();
mScene.unregisterUpdateHandler(mTimer);
}
});
mScene.registerUpdateHandler(mTimer);
}
示例4: onCreateScene
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
protected Scene onCreateScene() {
createHelpDialog();
mMainScene = new GameScene(mResourceManager, mCamera, this);
mMainScene.initViews(mResourceManager, mCamera);
mMainScene.updateLevel(mLevel);
mMainScene.setOnAreaTouchListener(this);
mRacer = mMainScene.mRacer;
mRacer.setX(LEFT_OFFSET);
mLevelHandler = new TimerHandler(45.0f, true, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
mEngine.getEngineLock().lock();
if (mLevel <= 15)
mLevel += 1;
mMainScene.updateLevel(mLevel);
mEngine.getEngineLock().unlock();
}
});
return mMainScene;
}
示例5: prepareScene
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public Scene prepareScene() {
Scene scene = activity.getScene();
final Background backgroundColor = new Background(0.84706f, 0.64706f, 0.84314f);
scene.setBackground(backgroundColor);
resetGamePoints();
createCards();
scene.setTouchAreaBindingOnActionDownEnabled(true);
TimerHandler myTimer = new TimerHandler(1, true, new ITimerCallback() {
public void onTimePassed(TimerHandler pTimerHandler) {
decrementTime();
}
});
scene.registerUpdateHandler(myTimer);
return scene;
}
示例6: updateGameScene
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void updateGameScene() {
if (gameService.solvedPuzzle()) {
setOnSceneTouchListener(null);
gameService.detatch(this);
baseScene.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
baseScene.unregisterUpdateHandler(pTimerHandler);
onSolvedGame();
}
}));
}
scoreText.setText(String.valueOf(gameService.getLevel().getMovesCount()));
updateTiles(gameService.solvedPuzzle());
}
示例7: onSolvedGame
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void onSolvedGame() {
restartButton.setVisible(false);
Level level = gameService.getLevel();
final LevelResult levelResult = levelService.calculateLevelResult(level);
levelService.persistLevelResult(levelResult);
int nextLevelId = level.getId() + 1;
levelService.unlockLevel(nextLevelId);
this.leaveScene = true;
engine.registerUpdateHandler(new TimerHandler(1.5f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
engine.unregisterUpdateHandler(pTimerHandler);
storyService.loadScoreScreen(levelResult);
}
}));
}
示例8: start
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void start() {
this.justPlayService = new JustPlayServiceImpl();
engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
engine.unregisterUpdateHandler(pTimerHandler);
ResourcesManager.getInstance().loadGameSceneResources();
ResourcesManager.getInstance().loadJustPlayScoreResources();
justPlayGameScene = new JustPlayGameScene(justPlayService.getNextLevel());
setScene(justPlayGameScene);
}
}));
}
示例9: loadJustPlaySceneFromJustPlayScene
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void loadJustPlaySceneFromJustPlayScene(final TimeBasedGameService timeBasedGameService,
final JustPlayLevel justPlayLevel) {
engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
engine.unregisterUpdateHandler(pTimerHandler);
justPlayGameScene.disposeScene();
justPlayGameScene = new JustPlayGameScene(timeBasedGameService, justPlayLevel);
setScene(justPlayGameScene);
}
}));
}
示例10: onBackKeyPressed
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void onBackKeyPressed() {
if (!leaveScene) {
leaveScene = true;
engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
engine.unregisterUpdateHandler(pTimerHandler);
storyService.loadMenuSceneFromJustPlayGameScene();
}
}));
}
}
示例11: onSolvedGame
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void onSolvedGame() {
timeBasedGameService.stop();
restartButton.setVisible(false);
if (!leaveScene) {
restartButton.setEnabled(false);
leaveScene = true;
engine.registerUpdateHandler(new TimerHandler(1f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
engine.unregisterUpdateHandler(pTimerHandler);
storyService.loadJustPlayScoreSceneFromJustPlayScene(
new JustPlayLevelResult(timeBasedGameService.getRemainingTime(),
gameService.getLevel().getMovesCount(),
gameService.getLevel().getMinimumMovesToSolve()));
}
}));
}
}
示例12: updateJustPlayScene
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void updateJustPlayScene() {
engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
leftTime.setText(String.valueOf(timeBasedGameService.getRemainingTime()));
if (timeBasedGameService.getRemainingTime() <= 5) {
backgroundFlash();
}
}
}));
if (timeBasedGameService.getRemainingTime() == 0 && !gameService.solvedPuzzle()) {
onLostGame();
}
}
示例13: addAnimation
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的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()));
}
示例14: addAnimation
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的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()));
}
示例15: disposeScene
import org.andengine.engine.handler.timer.TimerHandler; //导入依赖的package包/类
@Override
public void disposeScene() {
camera.setChaseEntity(null);
camera.setCenter(camera.getWidth() / 2, camera.getHeight() / 2);
rightArrow.setVisible(false);
leftArrow.setVisible(false);
camera.setHUD(null);
final LevelChoiceScene levelChoiceScene = this;
engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
engine.unregisterUpdateHandler(pTimerHandler);
arrowHud.detachChildren();
levelChoiceScene.detachChildren();
}
}));
}