コード例 #1
0
  private void handleRotateCharTouchEvent(TouchEvent touchEvent) {
    if (touchEvent.isActionDown()
        && Boundary.BoundaryUtils.isIntersecting(this.baPlayerBoundary, this.baTouchBoundary)) {
      this.isRotatingSkin = true;
      this.rotateCharInitalTouchX = touchEvent.getX();
      this.sRotateChar.setAlpha(1f);
    } else if (touchEvent.isActionUp()) {
      this.isRotatingSkin = false;
      this.sRotateChar.setAlpha(1f);
    }

    if (this.isRotatingSkin)
      if (touchEvent.isActionMove()) {
        final float DELTA = this.rotateCharInitalTouchX - touchEvent.getX();
        final float DELTA_ABS = Math.abs(DELTA);

        if (DELTA_ABS > MainMenuEditPlayer.ROTATE_MOVE_SENSITIVITY) {
          final int STEPS =
              (int) Math.floor(DELTA_ABS / MainMenuEditPlayer.ROTATE_MOVE_SENSITIVITY);

          MainMenuEditPlayer.skinMoveDirectionIndex += (DELTA > 0) ? STEPS : -STEPS;

          if (MainMenuEditPlayer.skinMoveDirectionIndex < 0)
            MainMenuEditPlayer.skinMoveDirectionIndex += Direction.values().length - 1;
          else if (MainMenuEditPlayer.skinMoveDirectionIndex > Direction.values().length - 2)
            MainMenuEditPlayer.skinMoveDirectionIndex -= Direction.values().length - 2;
          this.rotateCharInitalTouchX = touchEvent.getX();
          this.directPlayerSkin();
        }
      }
  }
コード例 #2
0
 protected void directPlayerSkin() {
   this.pcsPlayerSkinPreview.directSkin(
       Direction.values()[MainMenuEditPlayer.skinMoveDirectionIndex], true, 2.1f);
 }