コード例 #1
0
  private static void createOptionsGroup() {
    optionsGroup = new Group();
    optionsGroup.setVisible(false);
    final OptionsPanel p = new OptionsPanel(AbstractScreen.skin, "dialog");
    p.setName(OPTIONS_PANEL_NAME);
    final Button options = new ImageButton(AbstractScreen.skin, "ic_settings");
    options.setBounds(
        AbstractScreen.stagew - OPTIONS_BUTTON_WIDTH_HEIGHT,
        AbstractScreen.stageh - OPTIONS_BUTTON_WIDTH_HEIGHT,
        OPTIONS_BUTTON_WIDTH_HEIGHT,
        OPTIONS_BUTTON_WIDTH_HEIGHT);
    options.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            if (!p.isVisible()) {
              AbstractScreen.mockupController.show(p);
            } else {
              AbstractScreen.mockupController.hide(p);
            }
          }
        });
    TextureRegion t = AbstractScreen.skin.getRegion("ic_logo");

    Image i = new Image(t);
    i.setTouchable(Touchable.disabled);
    i.setX(AbstractScreen.halfstagew - t.getRegionWidth() / 2f);
    i.setY(AbstractScreen.halfstageh * 1.1f - t.getRegionHeight() / 2f);

    optionsGroup.addActor(i);
    optionsGroup.addActor(p);
    optionsGroup.addActor(options);
  }
コード例 #2
0
  private static void createNavigationGroup() {
    navigationGroup = new Group();
    navigationGroup.setVisible(false);
    Skin skin = AbstractScreen.skin;
    final ToolbarButton navigationButton = new ToolbarButton(skin.getDrawable("ic_menu"), skin);
    navigationButton.setBounds(
        0,
        AbstractScreen.stageh - NAVIGATION_BUTTON_WIDTH_HEIGHT,
        NAVIGATION_BUTTON_WIDTH_HEIGHT,
        NAVIGATION_BUTTON_WIDTH_HEIGHT);

    final NavigationPanel p = new NavigationPanel(AbstractScreen.skin, "default", navigationButton);
    p.setName(NAVIGATION_PANEL_NAME);
    p.setModal(false);
    navigationButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            // event.cancel();
            if (!p.isVisible()) {
              AbstractScreen.mockupController.show(p);
            } else {
              AbstractScreen.mockupController.hide(p);
            }
          }
        });

    navigationGroup.addActor(p);
    navigationGroup.addActor(navigationButton);
  }
コード例 #3
0
ファイル: HandGroup.java プロジェクト: nibuen/yomi-libgdx
 /** unzooms the currently zoomed card */
 private void unzoom() {
   stopMakingSpace();
   zoomCard.setTouchable(Touchable.enabled);
   zoomCard.addAction(Actions.scaleTo(1.0f, 1.0f, 0.2f, Interpolation.pow2));
   addCard(zoomCard, zoomReturnIndex);
   zoomCard = null;
   for (Actor actor : getChildren()) {
     actor.setTouchable(Touchable.enabled);
   }
   for (Actor actor : cards.getChildren()) {
     actor.setTouchable(Touchable.enabled);
   }
   zoomGroup.setTouchable(Touchable.disabled);
   zoomGroup.setVisible(false);
 }
コード例 #4
0
ファイル: HandGroup.java プロジェクト: nibuen/yomi-libgdx
  /**
   * brings the card up to the front and center, leaving a space where it belongs in the hand.
   * Nothing other than the card and its controls can be clicked during a zoom. Tapping the card
   * unzooms it. There also is a cancel, play, and rotate button, and arrows to see the next and
   * previous cards in the hand.
   *
   * @param toAdd card to zoom in on
   */
  private void zoomCard(CardGroup toAdd) {
    zoomCard = toAdd;
    // remove toAdd from the hand and add it to the root
    zoomReturnIndex = cards.getChildren().indexOf(toAdd, true);
    zoomCard.remove();
    addActor(zoomCard);
    makeSpace(zoomReturnIndex);

    zoomCard.getActions().clear();
    // blow the card up
    zoomCard.addAction(Actions.scaleTo(3.0f, 3.0f, 0.2f, Interpolation.pow2));
    // move it
    zoomCard.addAction(Actions.moveTo(600, 100, 0.2f, Interpolation.pow2));

    // make only the zoom elements touchable
    for (Actor actor : getChildren()) {
      actor.setTouchable(Touchable.disabled);
    }
    zoomGroup.setTouchable(Touchable.enabled);
    zoomGroup.setVisible(true);
    updateZoomControls();
  }
コード例 #5
0
ファイル: HandGroup.java プロジェクト: nibuen/yomi-libgdx
  public HandGroup(GameEventNotifier notifier) {
    super(notifier);

    cards = new Group();
    cards.setBounds(0, 0, UIConstants.WORLD_WIDTH, UIConstants.WORLD_HEIGHT / 2);

    addActor(cards);

    // set up the images and buttons for the zoom menu
    selectButton = new Image(selectTexture);
    selectButton.setScale(1.5f);
    selectButton.setPosition(220, 700);
    cancelButton = new Image(cancelTexture);
    cancelButton.setScale(1.5f);
    cancelButton.setPosition(220, 100);
    cancelButton.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // return the zoomed card
            unzoom();
            return true;
          }
        });
    nextCardImage = new Image(arrowTexture);
    nextCardImage.setScale(2f);
    nextCardImage.setPosition(1200, 300);
    nextCardImage.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            changeZoomedCard(1);
            return true;
          }
        });

    previousCardImage = new Image(arrowTexture);
    previousCardImage.rotateBy(180);
    previousCardImage.setScale(2f);
    previousCardImage.setPosition(500, 400);
    previousCardImage.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            changeZoomedCard(-1);
            return true;
          }
        });
    rotateImage = new Image(rotateTexture);
    rotateImage.setScale(0.5f);
    rotateImage.setPosition(350, 500);
    rotateImage.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            zoomCard.rotate();
            return true;
          }
        });
    zoomGroup = new Group();
    zoomGroup.addActor(selectButton);
    zoomGroup.addActor(cancelButton);
    zoomGroup.addActor(nextCardImage);
    zoomGroup.addActor(previousCardImage);
    zoomGroup.addActor(rotateImage);
    zoomGroup.setTouchable(Touchable.disabled);
    zoomGroup.setVisible(false);

    addActor(zoomGroup);
  }