Example #1
0
 public void openVotingScreen(String[] options) {
   GenericPopup voting = new GenericPopup();
   for (int i = 0; i < 3; i++) {
     GenericButton button = new ZVotingButton((i + 1) + ":" + options[i]);
     button.setHeight(24);
     button.setWidth(128);
     button.setAlign(WidgetAnchor.CENTER_CENTER);
     button.setAnchor(WidgetAnchor.CENTER_CENTER);
     button.shiftYPos(-24 + i * 24);
     button.shiftXPos(button.getWidth() / -2);
     voting.attachWidget(ZArena.getInstance(), button);
   }
   ((SpoutPlayer) Bukkit.getPlayer(player)).getMainScreen().attachPopupScreen(voting);
 }
  public static void open(
      Plugin plugin, SpoutPlayer splayer) { // method used to open the GUI for a player
    GenericTexture face = new GenericTexture();

    int width = splayer.getCurrentScreen().getWidth();
    int height = splayer.getCurrentScreen().getHeight();
    face.setUrl(
        "http://landoflegend.net/forums/images/CoderGreen/site_logo.png"); // this must be a png
                                                                           // image
    face.setWidth(splayer.getCurrentScreen().getWidth() / 8)
        .setHeight(
            splayer.getCurrentScreen().getHeight()
                / 8); // you can manipulate the size of most widgets
    // face.setAnchor(WidgetAnchor.CENTER_CENTER); // the enum type WidgetAnchor provides a
    // convenience method for placing widgets
    face.setX(width / 2 - face.getWidth() / 2);
    face.setY(height - face.getHeight() - 5);

    //        GenericButton button = new GenericButton("The Drogans?!");
    //        button.setWidth(80);
    //        button.setHeight(20);
    //        button.setX(width/4);
    //        button.setY(height/2);
    //        button.setAnchor(WidgetAnchor.CENTER_LEFT);

    GenericListWidget scrollTry = new GenericListWidget();
    ListWidgetItem item = new ListWidgetItem("Drogans", "Drogans");
    scrollTry.addItem(item);

    scrollTry.setX(width / 4);
    scrollTry.setY(height / 2);

    GenericLabel label = new GenericLabel("Clans - First try");
    // label.setAnchor(WidgetAnchor.CENTER_RIGHT);
    label.setWidth(80);
    label.setHeight(40);
    label.setScale(1);
    label.setX(width / 2 - label.getWidth() / 2);
    label.setY(20);

    GenericPopup popup = new GenericPopup(); // create the popup (A popup will "free the mouse")
    popup.attachWidget(plugin, face); // attach any widgets we want to the popup
    popup.attachWidget(plugin, scrollTry);
    popup.attachWidget(plugin, label);

    //        button.set

    splayer.closeActiveWindow();
    splayer.getMainScreen().attachPopupScreen(popup); // attach the popup to the players screen
  }
Example #3
0
  @Override
  public void onTick() {

    // make sure theres only one of an item in any slot
    SpoutItemStack nItem = new SpoutItemStack(needleSlot.getItem());
    if (nItem.getAmount() > 1) {

      ItemStack tossMe = nItem.clone();
      tossMe.setAmount(nItem.getAmount() - 1);
      tossItem(tossMe);

      nItem.setAmount(1);
      needleSlot.setItem(nItem);
    }

    SpoutItemStack rItem = new SpoutItemStack(recordSlot.getItem());
    if (rItem.getAmount() > 1) {

      ItemStack tossMe = rItem.clone();
      tossMe.setAmount(rItem.getAmount() - 1);
      tossItem(rItem);

      rItem.setAmount(1);
      recordSlot.setItem(rItem);
    }

    updatePlayerSlots();
    syncDataSlots();

    super.onTick();
  }
Example #4
0
 public void prevPage() {
   popup.removeWidgets(plugin);
   page--;
   if (page < 0) {
     page = 0;
   }
   createPopup(false, true);
 }
Example #5
0
 public void nextPage() {
   popup.removeWidgets(plugin);
   page++;
   if (page > maxPage) {
     page = maxPage;
   }
   createPopup(false, true);
 }
Example #6
0
  public void openOptions() {
    ZOptionsButton votingScreen =
        new ZOptionsButton("Voting Popup: " + isEnabled(votingScreenEnabled));
    ZOptionsButton zombieTextures =
        new ZOptionsButton("Zombie Textures: " + isEnabled(zombieTexturesEnabled));
    ZOptionsButton waveCounter =
        new ZOptionsButton("Wave Counter: " + isEnabled(waveCounterEnabled));

    votingScreen.setAnchor(WidgetAnchor.CENTER_CENTER);
    zombieTextures.setAnchor(WidgetAnchor.CENTER_CENTER);
    waveCounter.setAnchor(WidgetAnchor.CENTER_CENTER);

    votingScreen.shiftXPos(-160);
    votingScreen.shiftYPos(-80);
    zombieTextures.shiftXPos(-160);
    zombieTextures.shiftYPos(-30);
    waveCounter.shiftXPos(-160);
    waveCounter.shiftYPos(20);

    votingScreen.setWidth(150);
    votingScreen.setHeight(20);
    zombieTextures.setWidth(150);
    zombieTextures.setHeight(20);
    waveCounter.setWidth(150);
    waveCounter.setHeight(20);

    ZCloseButton close = new ZCloseButton("Close");
    close.setAlign(WidgetAnchor.CENTER_CENTER);
    close.setAnchor(WidgetAnchor.CENTER_CENTER);
    close.shiftXPos(0);
    close.shiftYPos(70);
    close.setWidth(100);
    close.setHeight(30);

    GenericPopup popup = new GenericPopup();

    popup.attachWidget(ZArena.getInstance(), votingScreen);
    popup.attachWidget(ZArena.getInstance(), zombieTextures);
    popup.attachWidget(ZArena.getInstance(), waveCounter);
    popup.attachWidget(ZArena.getInstance(), close);

    ((SpoutPlayer) Bukkit.getPlayer(player)).getMainScreen().attachPopupScreen(popup);
  }
Example #7
0
  public Tree(MMOSkillTree plugin, GenericPopup popup, SpoutPlayer sPlayer, SkillSet skillSet) {
    this.plugin = plugin;
    skillTreePopup = popup;
    Player p = (Player) sPlayer;
    // System.out.println("tree skillSet:"+skillSet);
    SkillsPlayer mmoPlayer = MMOSkillTree.mmoPlayerManager.get(p);
    Set set = mmoPlayer.getSet(skillSet);

    label = new GenericLabel("You probably wish this did something, but it doesn't yet.");
    label.setAnchor(WidgetAnchor.TOP_CENTER);
    label.setWidth(168).setHeight(10).setX(-90).setY(10);
    label.setScale(0.7F);
    skillTreePopup.attachWidget(plugin, label);

    infoBox = new GenericContainer();
    infoBox.setLayout(ContainerType.VERTICAL);
    infoBox.setWidth(50).setHeight(230);
    infoBox.setAnchor(WidgetAnchor.TOP_CENTER);
    infoBox.setAlign(WidgetAnchor.TOP_CENTER);
    infoBox.setX(-150).setY(11);
    skillTreePopup.attachWidget(plugin, infoBox);
    GenericLabel infoLabel =
        new GenericLabel(
            set.string
                + " Skills\n\n"
                + "Exp:"
                + set.getCurLvlXp()
                + "/"
                + set.getNextLvlXp()
                + "\n\n"
                + "Skill Points:"
                + set.skillPoints);
    infoLabel.setScale(0.5F);
    infoLabel.setMargin(5);
    infoBox.addChild(infoLabel);

    box = new GenericContainer();
    box.setLayout(ContainerType.VERTICAL);
    box.setAnchor(WidgetAnchor.TOP_CENTER);
    box.setWidth(168)
        .setHeight(
            210); // This is taller than it should be so the top skills align right to the top, and
                  // bottom ones to the bottom, instead of having a big gap
    box.setX(-84).setY(30);
    box.setPriority(RenderPriority.High);
    box.setAuto(true);

    swordSkills = new Sword();

    for (Entry<String, TreeSkill> entry : swordSkills.map.entrySet()) {
      // String key = entry.getKey();
      TreeSkill skill = entry.getValue();
      int row = skill.getRow();
      int col = skill.getCol();
      skills[row][col] = skill;
    }
    for (int row = 0; row < numRows; row++) {
      Container rowBox = new GenericContainer();
      rowBox.setLayout(ContainerType.HORIZONTAL);
      rowBox.setWidth(300).setHeight(38);
      for (int col = 0; col < numCols; col++) {
        if (skills[row][col] == null) {
          skills[row][col] = new TreeSkill();
        }
        TreeSkill skill = skills[row][col];
        skillSlots[row][col] =
            new SkillSlot(rowBox).setName(skill.getName()).setType(skill.getType());
      }
      box.addChild(rowBox);
    }
    for (int row = 0; row < numRows; row++) {
      for (int col = 0; col < numCols; col++) {
        SkillSlot skillSlot = skillSlots[row][col];
        TreeSkill skill = skills[row][col];
        String[] children = skill.getChildren();
        for (int i = 0; i < children.length; i++) {
          TreeSkill childSkill = swordSkills.getSkill(children[i]);
          // System.out.println(skill.getName() + " has child " + childSkill.getName());
          int childRow = childSkill.getRow();
          int childCol = childSkill.getCol();
          // System.out.println( "childRow:"+childRow + " row:"+row );
          // System.out.println( "childCol:"+childCol + " col:"+col );
          if (childCol == col && childRow == row + 1) {
            skillSlot.arrowToB();
          }
          if (childCol == col + 1 && childRow == row) {
            skillSlot.arrowToR();
          }
          if (childCol == col - 1 && childRow == row) {
            // System.out.println(skill.getName() +" to left to "+ childSkill.getName());
            skillSlot.arrowToL();
          }
          if (childCol == col + 1 && childRow == row + 1) {
            skillSlot.arrowToBR();
          }
          if (childCol == col - 1 && childRow == row + 1) {
            skillSlot.arrowToBL();
          }
          int botIterations = childRow - row;
          int rightIterations = childCol - col;
          if (botIterations > 1) {
            for (int ii = 0; ii <= botIterations; ii++) {
              // System.out.println("longL botIterations:"+botIterations + " ii:"+ii);
              SkillSlot lowerSkillSlot = skillSlots[ii][col];
              if (ii < botIterations) {
                lowerSkillSlot.arrowToLongB();
              } else {
                lowerSkillSlot.arrowToB();
              }
            }
          }
          if (rightIterations > 1) {
            for (int ii = 0; ii <= botIterations; ii++) {
              SkillSlot lowerSkillSlot = skillSlots[ii][col];
              if (ii < rightIterations) {
                lowerSkillSlot.arrowToLongR();
              } else {
                lowerSkillSlot.arrowToR();
              }
            }
          }
          if (rightIterations > -1) {
            for (int ii = 0; ii >= botIterations; ii--) {
              SkillSlot lowerSkillSlot = skillSlots[ii][col];
              if (ii > rightIterations) {
                lowerSkillSlot.arrowToLongL();
              } else {
                lowerSkillSlot.arrowToL();
              }
            }
          }
        }
      }
    }

    skillTreePopup.attachWidget(plugin, box);
  }
Example #8
0
 public void close() {
   skillTreePopup.removeWidget(box);
   skillTreePopup.removeWidget(label);
   skillTreePopup.removeWidget(infoBox);
   skillTreePopup.setDirty(true);
 }
Example #9
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);
  }