Example #1
0
  private void babyDring() {
    isHand = false;
    isUongSua = true;
    mMilkSprite.setVisible(false);
    mCryLeftSprite.setVisible(false);
    mCryRightSprite.setVisible(false);
    mCryLeftSprite.clearEntityModifiers();
    mCryRightSprite.clearEntityModifiers();
    A19_9B_5_NAKIGOE1.stop();
    A19_10_CHU.play();
    playSoundDelay(0.75f, A19_9D_5_WARAIGOE1);
    mFingerAnimatedSprite[4].animate(
        new long[] {750, 1200},
        new int[] {8, 9},
        0,
        new IAnimationListener() {

          @Override
          public void onAnimationFinished(AnimatedSprite arg0) {
            isHand = true;
            isUongSua = false;
            resetBaby();
            mFingerAnimatedSprite[4].setCurrentTileIndex(0);
          }

          @Override
          public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationStarted(AnimatedSprite arg0, int arg1) {
            // TODO Auto-generated method stub

          }
        });
  }
Example #2
0
  public void play(Sound sound) {
    if (mSoundEnabled) {
      long t1 = System.currentTimeMillis();
      if (sound == DROP) {
        if (t1 - groupDelay > 50) {
          sound.play();
          groupDelay = t1;
        }
        return;
      }

      if (sound == TACK) {
        if (t1 - tackDelay > 50) {
          sound.play();
          tackDelay = t1;
        }
        return;
      }
      sound.play();
    }
  }
Example #3
0
 private void babyDontCry() {
   mMilkSprite.setVisible(false);
   A19_9B_5_NAKIGOE1.stop();
   mCryLeftSprite.clearEntityModifiers();
   mCryRightSprite.clearEntityModifiers();
   mCryLeftSprite.setVisible(false);
   mCryRightSprite.setVisible(false);
   if (mFingerAnimatedSprite[4].isAnimationRunning()) {
     mFingerAnimatedSprite[4].stopAnimation();
   }
   mFingerAnimatedSprite[4].setCurrentTileIndex(0);
   resetBaby();
 }
Example #4
0
  private void doorAction() {
    final int ran = new Random().nextInt(DoorFrame.length);
    isDoor = false;
    A19_07_KONKON.play();
    this.mScene.registerUpdateHandler(
        new TimerHandler(
            1.0f,
            new ITimerCallback() {

              @Override
              public void onTimePassed(TimerHandler pTimerHandler) {
                handAction(ran);
                if (ran == 2) {
                  A19_07_KEIKOKUON.play();
                }
              }
            }));
    mDoorAnimatedSprite.animate(
        DoorDuration[ran],
        DoorFrame[ran],
        0,
        new IAnimationListener() {

          @Override
          public void onAnimationFinished(AnimatedSprite arg0) {
            mDoorAnimatedSprite.setCurrentTileIndex(0);
            isDoor = true;
            handDefault();
          }

          @Override
          public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationStarted(AnimatedSprite arg0, int arg1) {
            // TODO Auto-generated method stub

          }
        });
  }
  private void loadSounds() {
    SoundFactory.setAssetBasePath("sfx/");

    try {
      soundIntro =
          SoundFactory.createSoundFromAsset(
              this.engine.getSoundManager(), this.activity, "intro.ogg");
      soundIntro.setLooping(false);

    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Example #6
0
  private void jankenAction() {
    babyDontCry();
    isHand = false;
    setTouchGimmic3(false);
    A19_03_08_JANKEN2.play();
    final TimerHandler mJankenTimerHandler =
        new TimerHandler(
            0.75f,
            new ITimerCallback() {

              @Override
              public void onTimePassed(TimerHandler pTimerHandler) {
                int rand = new Random().nextInt(3);
                setVisibleHandDefault(false);
                mHandActionAniSprite.setCurrentTileIndex(rand);
                mHandActionAniSprite.setVisible(true);
                mHandActionAniSprite.setRotationCenter(333, 567);
                mHandActionAniSprite.registerEntityModifier(
                    new SequenceEntityModifier(
                        new IEntityModifierListener() {

                          @Override
                          public void onModifierFinished(
                              IModifier<IEntity> pModifier, IEntity pItem) {

                            Log.d(TAG, " Ket thuc");
                            handDefault();
                            setTouchGimmic3(true);
                          }

                          @Override
                          public void onModifierStarted(IModifier<IEntity> arg0, IEntity arg1) {
                            // TODO Auto-generated method
                            // stub

                          }
                        },
                        new RotationModifier(0.3f, 0, -10),
                        new RotationModifier(0.6f, -10, 10),
                        new RotationModifier(0.3f, 10, 0)));
              }
            });
    System.gc();
    this.mScene.registerUpdateHandler(mJankenTimerHandler);
  }
Example #7
0
  @Override
  public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
    if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
      int pX = (int) pSceneTouchEvent.getX();
      int pY = (int) pSceneTouchEvent.getY();

      if (mKaigaAnimatedSprite.contains(pX, pY)) {
        nextTileAnimatedSprite(mKaigaAnimatedSprite);
        A19_04_SAKUTON2.play();
      } else if (mTvAnimatedSprite.contains(pX, pY) && isTv && isHand) {
        isHand = false;
        tvAction();
        babyDontCry();
        resetBaby();
      } else if (checkContains(mClockAnimatedSprite, 29, 0, 171, 171, pX, pY) && isClock) {
        clockAction();
      } else if (checkContains(mDoorAnimatedSprite, 144, 26, 218, 383, pX, pY)
          && isDoor
          && isHand) {
        isHand = false;
        doorAction();
        babyDontCry();
        resetBaby();
      } else if (checkContains(mHandDefaultSprite, 227, 312, 454, 426, pX, pY) && isHand) {
        isHand = false;
        jankenAction();
        resetBaby();
      }
    }
    if (pSceneTouchEvent.isActionUp()) {
      if (mTempFringerAnimatedSprite != null) {
        if (mTempFringerAnimatedSprite.isAnimationRunning()) {
          mTempFringerAnimatedSprite.stopAnimation(0);
          mTempFringerAnimatedSprite = null;
        }
      }
      Log.d(TAG, " upup ,,,,,,,,,,,,,,,,,,,");
    }
    return true;
  }
Example #8
0
  private void babyCry() {
    isBabyCry = false;
    A19_9B_5_NAKIGOE1.play();
    mFingerAnimatedSprite[4].animate(new long[] {500, 300}, new int[] {6, 7}, 0);
    mMilkSprite.showAction();

    this.mScene.registerUpdateHandler(
        new TimerHandler(
            0.5f,
            new ITimerCallback() {

              @Override
              public void onTimePassed(TimerHandler pTimerHandler) {
                mCryLeftSprite.setVisible(true);
                mCryRightSprite.setVisible(true);
                mCryLeftSprite.setAlpha(1.0f);
                mCryRightSprite.setAlpha(1.0f);
              }
            }));

    final LoopEntityModifier loop = new LoopEntityModifier(new AlphaModifier(1.0f, 1.0f, 0.0f));
    mCryLeftSprite.registerEntityModifier(loop);
    mCryRightSprite.registerEntityModifier(loop.deepCopy());
  }
Example #9
0
  private void clockAction() {
    isClock = false;
    A19_06_BO_NBOBO_N.play();

    mClockAnimatedSprite.animate(
        new long[] {550, 550},
        new int[] {2, 3},
        1,
        new IAnimationListener() {

          @Override
          public void onAnimationFinished(AnimatedSprite arg0) {
            mClockAnimatedSprite.animate(new long[] {500, 500}, new int[] {0, 1}, -1);
          }

          @Override
          public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) {}

          @Override
          public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {}

          @Override
          public void onAnimationStarted(AnimatedSprite arg0, int arg1) {}
        });
    mClockCandyLeftSprite.setVisible(true);
    mClockCandyRightSprite.setVisible(true);

    mClockCandyLeftSprite.registerEntityModifier(
        new MoveModifier(1.2f, LpX, LpX - 20, LpY, LpY + 500));

    mClockCandyRightSprite.registerEntityModifier(
        new MoveModifier(
            1.2f,
            RpX,
            RpX + 20,
            RpY,
            RpY + 500,
            new IEntityModifierListener() {

              @Override
              public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
                runOnUpdateThread(
                    new Runnable() {

                      @Override
                      public void run() {

                        mClockCandyLeftSprite.clearEntityModifiers();
                        mClockCandyLeftSprite.setPosition(LpX, LpY);
                        mClockCandyLeftSprite.setVisible(false);

                        mClockCandyRightSprite.clearEntityModifiers();
                        mClockCandyLeftSprite.setPosition(RpX, RpY);
                        mClockCandyRightSprite.reset();
                        mClockCandyRightSprite.setVisible(false);
                        isClock = true;

                        Log.d("xxx", "" + mClockCandyLeftSprite.getY());
                      }
                    });
              }

              @Override
              public void onModifierStarted(IModifier<IEntity> arg0, IEntity arg1) {}
            }));
  }
Example #10
0
 public synchronized void stop(Sound sound) {
   sound.stop();
 }