Esempio n. 1
0
  /** Empty constructor for externalization. */
  public PlayerOptions() {
    waveCounter = new GenericTexture();
    waveCounter.setVisible(false);
    waveCounter.setDrawAlphaChannel(true);
    waveCounter.setUrl("http://i.imgur.com/fWiJl.png");
    waveCounter.setWidth(125);
    waveCounter.setHeight(125);
    waveCounter.setAnchor(WidgetAnchor.TOP_RIGHT);
    waveCounter.shiftXPos(-85);
    waveCounter.shiftYPos(-35);
    waveCounter.setPriority(RenderPriority.High);

    waveCounterWave = new GenericLabel("Wave: 0");
    waveCounterWave.setVisible(false);
    waveCounterWave.setAnchor(WidgetAnchor.TOP_RIGHT);
    waveCounterWave.setAlign(WidgetAnchor.CENTER_CENTER);
    waveCounterWave.shiftXPos(-35);
    waveCounterWave.shiftYPos(37);
    waveCounterWave.setTextColor(new Color(150, 0, 10));
    waveCounterWave.setHeight(10);
    waveCounterWave.setWidth(10);

    waveCounterZombies = new GenericLabel("0");
    waveCounterZombies.setVisible(false);
    waveCounterZombies.setAnchor(WidgetAnchor.TOP_RIGHT);
    waveCounterZombies.setAlign(WidgetAnchor.CENTER_CENTER);
    waveCounterZombies.shiftXPos(-40);
    waveCounterZombies.shiftYPos(18);
    waveCounterZombies.setTextColor(new Color(150, 0, 10));
    waveCounterZombies.setScale(2);
    waveCounterZombies.setHeight(20);
    waveCounterZombies.setWidth(20);
  }
Esempio n. 2
0
  public void openTabScreen() {
    tabHeader = new GenericTexture("http://i.imgur.com/t8CPF.png");
    tabHeader.setDrawAlphaChannel(true);
    tabHeader.setAnchor(WidgetAnchor.CENTER_CENTER);
    tabHeader.setWidth(212);
    tabHeader.setHeight(8);
    tabHeader.shiftYPos(-100);
    tabHeader.shiftXPos(tabHeader.getWidth() / -2 + 20);

    @SuppressWarnings({"unchecked", "rawtypes"})
    List<PlayerStats> sortedStats =
        new ArrayList(ZArena.getInstance().getGameHandler().getPlayerStats().values());
    Collections.sort(sortedStats);

    int index = 0;
    for (PlayerStats stats : sortedStats) {
      GenericTexture part = new GenericTexture("http://i.imgur.com/qvrX8.png");
      part.setDrawAlphaChannel(true);
      part.setAnchor(WidgetAnchor.CENTER_CENTER);
      part.setWidth(255);
      part.setHeight(15);
      part.shiftYPos(-90 + index * 15);
      part.shiftXPos(part.getWidth() / -2);
      part.setPriority(RenderPriority.Low);
      tabMain.add(part);

      Player player = stats.getPlayer();

      GenericLabel name = new GenericLabel(player.getName());
      name.setAnchor(WidgetAnchor.CENTER_CENTER);
      name.setAlign(WidgetAnchor.TOP_CENTER);
      name.setHeight(11);
      name.setWidth(10);
      name.shiftYPos(-86 + index * 15);
      name.shiftXPos(-75);

      GenericLabel kills = new GenericLabel(stats.getKills() + "");
      kills.setAnchor(WidgetAnchor.CENTER_CENTER);
      kills.setAlign(WidgetAnchor.TOP_CENTER);
      kills.setHeight(11);
      kills.setWidth(10);
      kills.shiftYPos(-86 + index * 15);

      GenericLabel money = new GenericLabel("$" + stats.getMoney());
      money.setAnchor(WidgetAnchor.CENTER_CENTER);
      money.setAlign(WidgetAnchor.TOP_CENTER);
      money.setHeight(11);
      money.setWidth(10);
      money.shiftYPos(-86 + index * 15);
      money.shiftXPos(50);

      GenericLabel health = new GenericLabel((stats.isAlive()) ? player.getHealth() + "" : "DEAD");
      health.setTextColor(
          (!stats.isAlive())
              ? new Color(150, 0, 0)
              : (player.getHealth() > 15)
                  ? new Color(0, 200, 0)
                  : (player.getHealth() > 10)
                      ? new Color(255, 255, 0)
                      : (player.getHealth() > 5) ? new Color(255, 140, 0) : new Color(200, 0, 0));
      health.setAnchor(WidgetAnchor.CENTER_CENTER);
      health.setAlign(WidgetAnchor.TOP_CENTER);
      health.setHeight(11);
      health.setWidth(10);
      health.shiftYPos(-86 + index * 15);
      health.shiftXPos(100);

      tabText.add(name);
      tabText.add(money);
      tabText.add(kills);
      tabText.add(health);

      index++;
    }

    ((SpoutPlayer) Bukkit.getPlayer(player))
        .getMainScreen()
        .attachWidget(ZArena.getInstance(), tabHeader);
    for (GenericTexture part : tabMain) {
      ((SpoutPlayer) Bukkit.getPlayer(player))
          .getMainScreen()
          .attachWidget(ZArena.getInstance(), part);
    }
    for (GenericLabel text : tabText) {
      ((SpoutPlayer) Bukkit.getPlayer(player))
          .getMainScreen()
          .attachWidget(ZArena.getInstance(), text);
    }
  }
Esempio n. 3
0
  public void createGUI(Player player) {

    GenericPopup pop = new GenericPopup();
    this.screenId = pop.getId();

    popcontainer.put(player, screenId);
    screencontainer.put(player, ms);

    GenericTexture label1 = new GenericTexture();
    label1.setUrl("http://dragontravel.phiwa.eu/images/DragonTravel-Banner_for_GUI.png");
    label1.setHeight(46).setWidth(230);
    label1.setPriority(RenderPriority.High);
    label1.setAnchor(WidgetAnchor.TOP_CENTER);
    label1.shiftXPos(-115);

    GenericLabel label2 = new GenericLabel();
    label2.setText(ChatColor.GOLD + "Destination");
    label2.setAnchor(WidgetAnchor.TOP_LEFT);
    label2.shiftXPos(40).shiftYPos(50);

    GenericLabel label3 = new GenericLabel();
    label3.setText(ChatColor.GOLD + "Travel to Destination");
    label3.setAnchor(WidgetAnchor.TOP_CENTER);
    label3.shiftXPos(40).shiftYPos(50);

    GenericLabel label4 = new GenericLabel();
    label4.setText(ChatColor.GOLD + "Station");
    label4.setAnchor(WidgetAnchor.TOP_LEFT);
    label4.shiftXPos(40).shiftYPos(110);

    GenericLabel label5 = new GenericLabel();
    label5.setText(ChatColor.GOLD + "Travel to Player");
    label5.setAnchor(WidgetAnchor.TOP_CENTER);
    label5.shiftXPos(40).shiftYPos(110);

    input1 = new GenericTextField();
    input1.setMaximumLines(15);
    input1.setHeight(15).setWidth(200);
    input1.setAnchor(WidgetAnchor.TOP_LEFT);
    input1.shiftXPos(40).setY(60);
    input1.setMaximumLines(1);
    input1.setFocus(false);

    input2 = new GenericTextField();
    input2.setMaximumLines(15);
    input2.setHeight(15).setWidth(200);
    input2.setAnchor(WidgetAnchor.TOP_CENTER);
    input2.shiftXPos(40).setY(60);
    input2.setMaximumLines(1);
    input2.setFocus(false);

    input3 = new GenericTextField();
    input3.setMaximumLines(15);
    input3.setHeight(15).setWidth(200);
    input3.setAnchor(WidgetAnchor.TOP_LEFT);
    input3.shiftXPos(40).setY(120);
    input3.setMaximumLines(1);
    input3.setFocus(false);

    input4 = new GenericTextField();
    input4.setMaximumLines(15);
    input4.setHeight(15).setWidth(200);
    input4.setAnchor(WidgetAnchor.TOP_CENTER);
    input4.shiftXPos(40).setY(120);
    input4.setMaximumLines(1);
    input4.setFocus(false);

    GenericButton button1 = new GenericButton("Create Destination");
    button1.setAlign(WidgetAnchor.CENTER_CENTER);
    button1.setAnchor(WidgetAnchor.TOP_LEFT);
    button1.shiftXPos(40).shiftYPos(80);
    button1.setHeight(15).setWidth(200);
    button1.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    GenericButton button2 = new GenericButton("Fly to Destination");
    button2.setAlign(WidgetAnchor.CENTER_CENTER);
    button2.setAnchor(WidgetAnchor.TOP_CENTER);
    button2.shiftXPos(40).shiftYPos(80);
    button2.setHeight(15).setWidth(200);
    button2.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    GenericButton button3 = new GenericButton("Create Station");
    button3.setAlign(WidgetAnchor.CENTER_CENTER);
    button3.setAnchor(WidgetAnchor.TOP_LEFT);
    button3.shiftXPos(40).shiftYPos(140);
    button3.setHeight(15).setWidth(200);
    button3.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    GenericButton button4 = new GenericButton("Fly to Player");
    button4.setAlign(WidgetAnchor.CENTER_CENTER);
    button4.setAnchor(WidgetAnchor.TOP_CENTER);
    button4.shiftXPos(40).shiftYPos(140);
    button4.setHeight(15).setWidth(200);
    button4.setHoverColor(new Color(1.0F, 5, 0, 1.0F));

    pop.attachWidget(instance, label1);
    pop.attachWidget(instance, label2);
    pop.attachWidget(instance, label3);
    pop.attachWidget(instance, label4);
    pop.attachWidget(instance, label5);

    pop.attachWidget(instance, input1);
    pop.attachWidget(instance, input2);
    pop.attachWidget(instance, input3);
    pop.attachWidget(instance, input4);

    pop.attachWidget(instance, button1);
    pop.attachWidget(instance, button2);
    pop.attachWidget(instance, button3);
    pop.attachWidget(instance, button4);

    ((SpoutPlayer) player).getMainScreen().attachPopupScreen(pop);
  }