@Override public void onPauseGame() { if (!isDrawView || !isPreView) { return; } Log.i(TAG, "-- onPauseGame --"); this.unregisterUpdateHandler(updateHandler); CUBIC_SLOT[0] = false; CUBIC_SLOT[1] = false; mArrowSprite.setVisible(false); mSuzuAniSprite.stopAnimation(0); mShishiAniSprite.stopAnimation(); mShishiAniSprite.clearEntityModifiers(); mShishiAniSprite.resetLocalToFirst(); mShishiAniSprite.setVisible(false); for (int i = 0; i < mCubicEntity.length; i++) { if (mCubicEntity[i] != null) { mCubicEntity[i].clearAll(); } } if (faceSequenceEntityModifier != null) { this.unregisterEntityModifier(faceSequenceEntityModifier); faceSequenceEntityModifier = null; } for (int i = 1; i < mTabSprite.length; i++) { mTabSprite[i].setVisible(false); } }
public void clearAll() { this.setVisible(false); ACTION = ACTION_DEFAULT; this.unregisterUpdateHandler(timerHandler); mCubicStartAniSprite.clearEntityModifiers(); mCubicStartAniSprite.clearUpdateHandlers(); mCubicStartAniSprite.stopAnimation(0); mCubicStartAniSprite.setVisible(false); mCubicTurnAniSprite.clearEntityModifiers(); mCubicTurnAniSprite.clearUpdateHandlers(); mCubicTurnAniSprite.stopAnimation(0); mCubicTurnAniSprite.setVisible(false); mCubicStopAniSprite.clearEntityModifiers(); mCubicStopAniSprite.clearUpdateHandlers(); mCubicStopAniSprite.stopAnimation(0); mCubicStopAniSprite.setVisible(false); mScrollLeftSprite.clearEntityModifiers(); mScrollLeftSprite.setVisible(false); for (int i = 0; i < mCubicTurnOptionAniSprite.length; i++) { mCubicTurnOptionAniSprite[i].setVisible(false); mCubicTurnOptionAniSprite[i].clearEntityModifiers(); mCubicTurnOptionAniSprite[i].clearUpdateHandlers(); mCubicTurnOptionAniSprite[i].stopAnimation(); } removePhysics(this); }
private void action(int action) { mCubicStartAniSprite.setVisible(false); mCubicStartAniSprite.stopAnimation(0); switch (action) { case ACTION_TURN_LEVEL_1: case ACTION_TURN_LEVEL_2: case ACTION_TURN_LEVEL_3: ACTION = action; final Body body = (Body) this.getUserData(); final Vector2 vector2 = Vector2Pool.obtain(body.getPosition()); int frame[] = new int[] {0, 1}; body.setAngularDamping(1.2f); vector2.x = vector2.x / 3; vector2.y = vector2.y / 3; if (action == ACTION_TURN_LEVEL_2) { frame = new int[] {2, 3}; body.setAngularDamping(2.2f); vector2.x = vector2.x / 2; vector2.y = vector2.y / 2; } else if (action == ACTION_TURN_LEVEL_3) { frame = new int[] {4, 5}; body.setAngularDamping(3.2f); } Vol3Osyougatsu.OGG_A3_A_5_KOMATEI.play(); mCubicTurnAniSprite.animate(new long[] {250, 250}, frame, -1); mCubicTurnAniSprite.setVisible(true); body.setActive(true); Log.i(TAG, "body.getPosition " + vector2); vector2.x = random(vector2.x) + new Random().nextFloat(); vector2.y = random(vector2.y) + new Random().nextFloat(); body.setLinearVelocity(vector2); Log.i(TAG, "body.getPosition change " + vector2); this.unregisterUpdateHandler(timerHandler); this.registerUpdateHandler( timerHandler = new TimerHandler( 6f, new ITimerCallback() { @Override public void onTimePassed(TimerHandler timerHandler) { // Stop Turn stopTurn(); } })); break; } }
// Function Stop Turn when out time and collision "shishi" public void stopTurn() { Vol3Osyougatsu.OGG_A3_A_5_KOMATEI.stop(); ACTION = ACTION_TURN_STOP; for (int i = 0; i < mCubicTurnOptionAniSprite.length; i++) { mCubicTurnOptionAniSprite[i].stopAnimation(); mCubicTurnOptionAniSprite[i].setVisible(false); } mCubicTurnAniSprite.stopAnimation(0); mCubicTurnAniSprite.setVisible(false); removePhysics(CubicEntity.this); mCubicStopAniSprite.animate( new long[] {200, 1000}, new int[] {0, 1}, 0, new IAnimationListener() { @Override public void onAnimationStarted(AnimatedSprite arg0, int arg1) { mCubicStopAniSprite.setVisible(true); } @Override public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {} @Override public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) { Log.i("XXX", arg1 + " Changed ID : " + arg2); int index = arg2; if (index == -1) { index = 0; } if (index >= 2) return; float width = mCubicStopAniSprite.getTiledTextureRegion().getWidth(index); float height = mCubicStopAniSprite.getTiledTextureRegion().getHeight(index); Log.i("XXX", width + " ~ " + height); mCubicStopAniSprite.setWidth(width); mCubicStopAniSprite.setHeight(height); } @Override public void onAnimationFinished(AnimatedSprite arg0) { CubicEntity.this.clearAll(); mCubicChooseSpite[CubicEntity.this.TYPE].setVisible(true); CUBIC_SLOT[SLOT] = false; checkArrow(); } }); }
private void touchToTurn(final int pAction) { Vol3Osyougatsu.OGG_A3_A_5_SPACE6.play(); final int ran = new Random().nextInt(mCubicTurnOptionAniSprite.length); if (ran == 0) { ACTION = ACTION_TURN_GIRL; } else if (ran == 1) { ACTION = ACTION_TURN_BOY; } else if (ran == 2) { ACTION = ACTION_TURN_FUNGI; } mCubicTurnAniSprite.stopAnimation(); mCubicTurnAniSprite.setVisible(false); mCubicTurnOptionAniSprite[ran].animate( new long[] {250, 250}, new int[] {0, 1}, 2, new IAnimationListener() { @Override public void onAnimationStarted(AnimatedSprite arg0, int arg1) { mCubicTurnOptionAniSprite[ran].setVisible(true); } @Override public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {} @Override public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) {} @Override public void onAnimationFinished(AnimatedSprite arg0) { mCubicTurnOptionAniSprite[ran].setVisible(false); mCubicTurnOptionAniSprite[ran].stopAnimation(); ACTION = pAction; int frame[] = new int[] {0, 1}; if (ACTION == ACTION_TURN_LEVEL_2) { frame = new int[] {2, 3}; } else if (ACTION == ACTION_TURN_LEVEL_3) { frame = new int[] {4, 5}; } // run back... mCubicTurnAniSprite.animate(new long[] {250, 250}, frame, -1); mCubicTurnAniSprite.setVisible(true); } }); }
public void StopAnimation() { if (animatedSprite.isAnimationRunning()) animatedSprite.stopAnimation(); }