Exemplo n.º 1
0
 /** Set up benchmark table and the rest */
 private void setUp(BenchmarkPosition benchmarkPosition) {
   table = new Table();
   table.setFillParent(true);
   table.setTouchable(Touchable.disabled);
   stage.addActor(table);
   //
   setUpBencmarks();
   setUpPosition(benchmarkPosition);
 }
    void layout() {
      root.defaults().space(6);
      root.columnDefaults(0).top().right().padTop(3);
      root.columnDefaults(1).left();
      root.add("Scale:");
      {
        Table table = table();
        table.add(scaleLabel).width(29);
        table.add(scaleSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Flip:");
      root.add(table(flipXCheckbox, flipYCheckbox)).row();
      root.add("Debug:");
      root.add(table(debugBonesCheckbox, debugRegionsCheckbox, debugBoundingBoxesCheckbox)).row();
      root.add();
      root.add(table(debugMeshHullCheckbox, debugMeshTrianglesCheckbox, debugPathsCheckbox)).row();
      root.add("Atlas alpha:");
      root.add(premultipliedCheckbox).row();

      root.add(new Image(skin.newDrawable("white", new Color(0x4e4e4eff))))
          .height(1)
          .fillX()
          .colspan(2)
          .pad(-3, 0, 1, 0)
          .row();

      root.add("Setup pose:");
      root.add(table(bonesSetupPoseButton, slotsSetupPoseButton, setupPoseButton)).row();
      root.add("Skin:");
      root.add(skinScroll).expand().fill().row();

      root.add(new Image(skin.newDrawable("white", new Color(0x4e4e4eff))))
          .height(1)
          .fillX()
          .colspan(2)
          .pad(1, 0, 1, 0)
          .row();

      root.add("Track:");
      {
        Table table = table();
        for (TextButton button : trackButtons.getButtons()) table.add(button);
        table.add(loopCheckbox);
        root.add(table).row();
      }
      root.add("Entry alpha:");
      {
        Table table = table();
        table.add(alphaLabel).width(29);
        table.add(alphaSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Animation:");
      root.add(animationScroll).expand().fill().row();
      root.add("Default mix:");
      {
        Table table = table();
        table.add(mixLabel).width(29);
        table.add(mixSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Speed:");
      {
        Table table = table();
        table.add(speedLabel).width(29);
        table.add(speedSlider).fillX().expandX();
        root.add(table).fill().row();
      }

      window.add(root).expand().fill();
      window.pack();
      stage.addActor(window);

      stage.addActor(statusLabel);

      {
        Table table = new Table();
        table.setFillParent(true);
        table.setTouchable(Touchable.disabled);
        stage.addActor(table);
        table.pad(10, 10, 22, 10).bottom().right();
        table.add(toasts);
      }

      {
        Table table = new Table();
        table.setFillParent(true);
        table.setTouchable(Touchable.disabled);
        stage.addActor(table);
        table.pad(10).top().right();
        table.defaults().right();
        table.add(new Label("", skin, "default", Color.LIGHT_GRAY)); // Version.
      }
    }
  public HotbarInventoryView(
      Stage stage,
      Skin skin,
      Inventory hotbarInventory,
      Inventory inventory,
      DragAndDrop dragAndDrop,
      OreClient client) {
    m_skin = skin;
    m_inventory = inventory;
    m_client = client;
    m_stage = stage;

    m_hotbarInventory = hotbarInventory;
    // attach to the inventory model
    m_hotbarInventory.addListener(this);

    container = new Table(m_skin);
    container.setFillParent(true);
    container.top().left().setSize(800, 100);
    container.padLeft(10).padTop(10);

    container.defaults().space(4);

    stage.addActor(container);

    Image dragImage = new Image();
    dragImage.setSize(32, 32);

    for (byte i = 0; i < Inventory.maxHotbarSlots; ++i) {

      Image slotImage = new Image();

      SlotElement element = new SlotElement();
      m_slots[i] = element;

      element.itemImage = slotImage;

      Table slotTable = new Table(m_skin);
      element.table = slotTable;
      slotTable.setTouchable(Touchable.enabled);
      slotTable.addListener(new SlotClickListener(this, i));
      slotTable.addListener(new SlotInputListener(this, i));

      slotTable.add(slotImage);
      slotTable.background("default-pane");

      slotTable.row();

      Label itemCount = new Label(null, m_skin);
      slotTable.add(itemCount).bottom().fill();
      element.itemCountLabel = itemCount;

      //            container.add(slotTable).size(50, 50);
      container.add(slotTable).fill().size(50, 50);
      setHotbarSlotVisible(i, false);

      dragAndDrop.addSource(new HotbarDragSource(slotTable, i, dragImage, this));

      dragAndDrop.addTarget(new HotbarDragTarget(slotTable, i, this));
    }

    m_tooltip = new Label(null, m_skin);
    stage.addActor(m_tooltip);
  }
Exemplo n.º 4
0
  @Override
  public void show() {
    super.show();

    backgroundStage.addActor(new Image(atlas.findRegion("background")));

    Image alien = new Image(atlas.findRegion("alien"));
    alien.setPosition(mainStage.getWidth() + mainStage.getPadLeft(), -365f);
    mainStage.addActor(alien);

    Image energy = new Image(atlas.findRegion("energy")); // 195, 313
    energy.setPosition(83f, 201f);
    energy.setScale(0f);
    energy.setOrigin(energy.getPrefWidth() / 2, energy.getPrefHeight() / 2);
    mainStage.addActor(energy);

    final Table certificateTable = new Table();
    certificateTable.padTop(314f).padBottom(101f).defaults().padBottom(100f);
    certificateTable.setBackground(new TextureRegionDrawable(atlas.findRegion("certificate")));
    certificateTable.setSize(mainStage.getWidth(), mainStage.getHeight());
    certificateTable.setOrigin(195f, 313f);
    certificateTable.setTransform(true);
    certificateTable.setTouchable(Touchable.disabled);
    certificateTable.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Assets.fanfareFX.stop();
            game.loadNextScreen(EndingScreen.this, KonnectingGame.ScreenType.MAIN_MENU);
          }
        });
    certificateTable.setScale(0f);
    mainStage.addActor(certificateTable);

    StatsData tempData = SavedData.getStats();
    int score =
        tempData.kronosScore1
            + tempData.kronosScore2
            + tempData.kronosScore3
            + tempData.kronosScore4
            + tempData.kronosScore5
            + tempData.kronosScore6
            + tempData.kronosScore7
            + tempData.zappingScore1
            + tempData.zappingScore2
            + tempData.zappingScore3
            + tempData.zappingScore4
            + tempData.zappingScore5;

    final Label userLabel =
        new Label(
            SavedData.getUsername() + "\n\n" + score + "pt",
            new Label.LabelStyle(uiSkin.getFont("default-font"), Color.WHITE));
    userLabel.setWrap(true);
    userLabel.setAlignment(Align.center);
    userLabel.getColor().a = 0f;
    certificateTable.add(userLabel).width(407f).row();

    String correctComment = comments[0];
    for (int i = scoreLimits.length - 1; i >= 0; i--) {
      if (score > scoreLimits[i]) {
        correctComment = comments[i];
        break;
      }
    }
    final Label commentLabel =
        new Label(correctComment, new Label.LabelStyle(uiSkin.getFont("arial"), Color.WHITE));
    commentLabel.setWrap(true);
    commentLabel.setFontScale(0.9f);
    commentLabel.setAlignment(Align.center);
    commentLabel.getColor().a = 0f;
    certificateTable.add(commentLabel).width(407f);

    Timeline.createSequence()
        .push(Tween.to(alien, ActorAccessor.MOVE_X, 1f).target(20f))
        .pushPause(0.25f)
        .push(Tween.to(energy, ActorAccessor.SCALEXY, 1f).target(1f))
        .push(Tween.to(energy, ActorAccessor.SCALEXY, 0.5f).target(0.8f))
        .push(Tween.to(energy, ActorAccessor.SCALEXY, 0.5f).target(1f))
        .push(Tween.to(certificateTable, ActorAccessor.SCALEXY, 0.5f).target(1f))
        .beginParallel()
        .push(Tween.to(userLabel, ActorAccessor.ALPHA, 0.5f).target(1f))
        .push(Tween.to(commentLabel, ActorAccessor.ALPHA, 0.5f).target(1f))
        .end()
        .setCallback(
            new TweenCallback() {
              @Override
              public void onEvent(int type, BaseTween<?> source) {
                Assets.fanfareFX.setOnCompletionListener(
                    new Music.OnCompletionListener() {
                      @Override
                      public void onCompletion(Music music) {
                        Assets.fanfareFX.setOnCompletionListener(null);
                        certificateTable.setTouchable(Touchable.enabled);
                      }
                    });
                Assets.fanfareFX.play();
              }
            })
        .start(tweenManager);
  }