コード例 #1
0
ファイル: PlayerOptions.java プロジェクト: smaltby/ZArena
  /** 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);
  }
コード例 #2
0
ファイル: MainGUI.java プロジェクト: croxis/AmbientSpout
 private void addCredit() {
   GenericLabel label =
       new GenericLabel(
           "AmbientSpout Free v"
               + AmbientSpout.callback.getDescription().getVersion()
               + " - By Rahazan.");
   label.setTextColor(new Color(0.4F, 0.4F, 0.4F));
   label.setAnchor(WidgetAnchor.TOP_LEFT);
   label.setWidth(180).setHeight(6);
   label.shiftXPos(1).shiftYPos(1);
   this.attachWidget(AmbientSpout.callback, label);
 }
コード例 #3
0
ファイル: MainGUI.java プロジェクト: croxis/AmbientSpout
  public MainGUI(Player p) {
    this.p = p;
    nextSongButton = new GenericButton("Music On"); // The first button.
    nextSongButton.setAnchor(
        WidgetAnchor
            .CENTER_CENTER); // We are "sticking" it from the center_center, from there we will be
                             // shifting.
    nextSongButton.setWidth(90).setHeight(20); // Setting the width and height of the button.
    nextSongButton.shiftXPos(-90 / 2).shiftYPos(-nextSongButton.getHeight() / 2 + 5);

    stopMusicButton = new GenericButton("Music Off"); // The second button.
    stopMusicButton.setAnchor(WidgetAnchor.CENTER_CENTER);
    stopMusicButton.setWidth(90).setHeight(20);
    // stopMusicButton.shiftXPos(0).shiftYPos(stopMusicButton.getHeight()/2);
    stopMusicButton.shiftXPos(-90 / 2).shiftYPos((int) (stopMusicButton.getHeight() * 1.1));

    if (Settings.useBackgroundImage) addBackground();

    currentSongLabel = new GenericLabel("");
    currentSongLabel.setAnchor(WidgetAnchor.CENTER_CENTER);
    currentSongLabel.setWidth(200).setHeight(10);
    currentSongLabel.shiftXPos(-50).shiftYPos(50);
    currentSongLabel.setTextColor(new Color(200, 200, 200));
    if (Settings.showCurrentSong) this.attachWidget(AmbientSpout.callback, currentSongLabel);

    if (!AmbientSpout.callback.getConfig().getBoolean("Settings.Donation", false)) addCredit();

    if (Model.playerMusicEnabled.containsKey(p.getName())) {
      if (Model.playerMusicEnabled.get(p.getName())) {
        nextSongButton.setText("Next Song");
        updateCurrentSong();
      } else {
        stopMusicButton.setVisible(false);
      }
    }

    if (p.hasPermission("ambientspout.admin") || p.isOp()) {
      // System.out.println("Adding EffectLoopButton"); //TODO DebugOnly

      addEffectLoopButton();
    }

    this.attachWidget(AmbientSpout.callback, nextSongButton);
    this.attachWidget(AmbientSpout.callback, stopMusicButton);
  }
コード例 #4
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);
  }
コード例 #5
0
ファイル: PlayerOptions.java プロジェクト: smaltby/ZArena
  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);
    }
  }
コード例 #6
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);
  }