Ejemplo n.º 1
0
  @Override
  public boolean onMenuItemClicked(
      final MenuScene pMenuScene,
      final IMenuItem pMenuItem,
      final float pMenuItemLocalX,
      final float pMenuItemLocalY) {
    switch (pMenuItem.getID()) {
      case MENU_MUSIC:
        if (audioOptions.getBoolean("musicOn", true)) {
          audioEditor.putBoolean("musicOn", false);
          if (StartActivity.mMusic.isPlaying()) StartActivity.mMusic.pause();
        } else {
          audioEditor.putBoolean("musicOn", true);
          StartActivity.mMusic.resume();
        }
        audioEditor.commit();
        createOptionsMenuScene();
        mMainScene.clearChildScene();
        mMainScene.setChildScene(mOptionsMenuScene);
        return true;
      case MENU_EFFECTS:
        if (audioOptions.getBoolean("effectsOn", true)) {
          audioEditor.putBoolean("effectsOn", false);
        } else {
          audioEditor.putBoolean("effectsOn", true);
        }
        audioEditor.commit();
        createOptionsMenuScene();
        mMainScene.clearChildScene();
        mMainScene.setChildScene(mOptionsMenuScene);
        return true;
      case MENU_WAV:
        mMainScene.registerEntityModifier(
            new ScaleAtModifier(0.5f, 1.0f, 0.0f, CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2));
        mOptionsMenuScene.registerEntityModifier(
            new ScaleAtModifier(0.5f, 1.0f, 0.0f, CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2));
        mHandler.postDelayed(mLaunchWAVTask, 1000);
        return true;

      default:
        return false;
    }
  }
Ejemplo n.º 2
0
  @Override
  public boolean onMenuItemClicked(
      final MenuScene pMenuScene,
      final IMenuItem pMenuItem,
      final float pMenuItemLocalX,
      final float pMenuItemLocalY) {
    switch (pMenuItem.getID()) {
      case MENU_MUSIC:
        if (isMusicOn) {
          isMusicOn = false;
        } else {
          isMusicOn = true;
        }
        createOptionsMenuScene();
        mMainScene.clearChildScene();
        mMainScene.setChildScene(mOptionsMenuScene);
        return true;
      case MENU_EFFECTS:
        if (isEffectsOn) {
          isEffectsOn = false;
        } else {
          isEffectsOn = true;
        }
        createOptionsMenuScene();
        mMainScene.clearChildScene();
        mMainScene.setChildScene(mOptionsMenuScene);
        return true;
      case MENU_WAV:
        mMainScene.registerEntityModifier(new ScaleModifier(1.0f, 1.0f, 0.0f));
        mOptionsMenuScene.registerEntityModifier(new ScaleModifier(1.0f, 1.0f, 0.0f));
        mHandler.postDelayed(mLaunchWAVTask, 1000);
        return true;

      default:
        return false;
    }
  }