Package org.getspout.spoutapi.gui

Examples of org.getspout.spoutapi.gui.GenericLabel


      List<GenericLabel> teamlines = new ArrayList<GenericLabel>();
      List<GenericLabel> playerlines = new ArrayList<GenericLabel>();
      List<GenericLabel> scorelines = new ArrayList<GenericLabel>();
      List<GenericLabel> lifelines = new ArrayList<GenericLabel>();
      int teamMax = 0, scoreMax = 0, lifeMax = 0;
      GenericLabel line;
     
      GenericLabel teamsHeader = new GenericLabel(ChatColor.GRAY + "War> " + ChatColor.WHITE + zone.getName());
      int teamsHeaderWidth = GenericLabel.getStringWidth(teamsHeader.getText()) + 1;
      teamsHeader.setAnchor(WidgetAnchor.TOP_LEFT)
        .setX(3)
        .setY(2)
        .setWidth(teamsHeaderWidth)
        .setHeight(LINE_HEIGHT);
      lines.add(teamsHeader);
         
      // First, we collect all the team names
          int lineCounter = 1;
      for (Team t : zone.getTeams()) {
        // team name
        String teamStr = t.getName() + " (" + t.getPlayers().size() + "/" + t.getTeamConfig().resolveInt(TeamConfig.TEAMSIZE) + ")";
        line = new GenericLabel(teamStr);
        if (t.getPlayers().size() == 0) {
          line.setTextColor(new Color(100,100,100));
        }
        else {
          line.setText(t.getKind().getColor() + teamStr.replace("(", ChatColor.GRAY + "(" + ChatColor.WHITE).replace(")", ChatColor.GRAY + ")" + ChatColor.WHITE));
        }
            line.setAnchor(WidgetAnchor.TOP_LEFT)
              .setX(3)
              .setY(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN)
              .setWidth(GenericLabel.getStringWidth(line.getText()))
              .setHeight(LINE_HEIGHT);
            teamlines.add(line);
            lineCounter++;
      }
     
      // We need to find the longest name
      for (GenericLabel l : teamlines) {
        if (GenericLabel.getStringWidth(l.getText()) > teamMax) {
          teamMax = GenericLabel.getStringWidth(l.getText());
        }
        if (teamsHeaderWidth > teamMax) {
          teamMax = teamsHeaderWidth;
        }
      }
     
      // points header
      GenericLabel pointsHeader = new GenericLabel(ChatColor.GRAY + "score");
      int pointsHeaderWidth = GenericLabel.getStringWidth(pointsHeader.getText());
      pointsHeader.setAnchor(WidgetAnchor.TOP_LEFT)
        .setX(3 + teamMax + 2)
        .setY(2)
        .setWidth(pointsHeaderWidth)
        .setHeight(LINE_HEIGHT);
      lines.add(pointsHeader);
     
     
      lineCounter = 1;
      for (Team t : zone.getTeams()) {
        // scores
        line = new GenericLabel(t.getPoints() + "/" + t.getTeamConfig().resolveInt(TeamConfig.MAXSCORE));
        if (t.getPlayers().size() == 0) line.setTextColor(new Color(100, 100, 100));
            line.setAnchor(WidgetAnchor.TOP_LEFT)
              .setX(3 + teamMax + 4)
              .setY(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN)
              .setWidth(GenericLabel.getStringWidth(line.getText()))
              .setHeight(LINE_HEIGHT);
            scorelines.add(line);
            lineCounter++;
      }
     
      for (GenericLabel l : scorelines) {
        if (GenericLabel.getStringWidth(l.getText()) > scoreMax) {
          scoreMax = GenericLabel.getStringWidth(l.getText());
        }
      }
      if (pointsHeaderWidth > scoreMax) {
        scoreMax = pointsHeaderWidth;
      }
     
      // lifepool header
      GenericLabel livesHeader = new GenericLabel(ChatColor.GRAY + "lives");
      int livesHeaderWidth = GenericLabel.getStringWidth(livesHeader.getText());
      livesHeader.setAnchor(WidgetAnchor.TOP_LEFT)
        .setX(3 + teamMax + 4 + scoreMax + 2)
        .setY(2)
        .setWidth(livesHeaderWidth)
        .setHeight(LINE_HEIGHT);
      lines.add(livesHeader);
     
     
      // and finally, lives.
      lineCounter = 1;
      for (Team t : zone.getTeams()) {
        line = new GenericLabel(t.getRemainingLifes() + "/" + t.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL));
        if (t.getPlayers().size() == 0) line.setTextColor(new Color(100, 100, 100));
            line.setAnchor(WidgetAnchor.TOP_LEFT)
              .setX(3 + teamMax + 4 + scoreMax + 4)
              .setY(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN)
              .setWidth(GenericLabel.getStringWidth(line.getText()))
View Full Code Here


              verticalOffset += LINE_HEIGHT_WITH_MARGIN;
            }
 
            word = addMissingColor(word, zone);
           
            GenericLabel label = new GenericLabel(word);
            int width = GenericLabel.getStringWidth(word);
            label.setAnchor(WidgetAnchor.TOP_LEFT);
            label.setWidth(width);
            label.setHeight(LINE_HEIGHT);
            label.setX(horizontalOffset);
            label.setY(verticalOffset);
           
            player.getMainScreen().attachWidget(War.war, label);
 
            horizontalOffset += width + 2;
          }
View Full Code Here

    public static void Init(Spout spout)
    {

        spoutPlugin = spout;

        lblZoneName = new GenericLabel(spoutPlugin.toString());
        lblZoneName.shiftYPos(2);
        lblZoneName.shiftXPos(-2);
        lblZoneName.setAuto(true);

        lblXYZ = new GenericLabel(spoutPlugin.toString());
        lblXYZ.shiftYPos(2);
        lblXYZ.setVisible(false);
        lblXYZ.setAuto(true);
    }
View Full Code Here

        private final GenericLabel label;
        private final GenericGradient box;
        private final SpoutPlayer player;

        public StatusBar(SpoutPlayer player) {
            this.label = (GenericLabel) new GenericLabel(ChatColor.DARK_AQUA + "Invisible").setAnchor(WidgetAnchor.BOTTOM_LEFT).setX(20).setY(-20).setHeight(10).setWidth(40);
            this.box = (GenericGradient) new GenericGradient().setTopColor(SpoutCraftHook.this.boxColor).setBottomColor(SpoutCraftHook.this.boxColor).setX(18).setY(-22).setHeight(12).setWidth(45).setAnchor(WidgetAnchor.BOTTOM_LEFT).setPriority(RenderPriority.High);
            this.player = player;
        }
View Full Code Here

           
            ResidencePopup popup = new ResidencePopup(PopupType.FLAG_GUI);

            popup.getMetaData().put("admin", resadmin);
           
            popup.gridAttachWidget(plug, new GenericLabel("Admin: ").setTextColor(textPrimaryColor), 3, 1);
            popup.gridAttachWidget(plug, new GenericLabel(Boolean.toString(resadmin)).setTextColor(textSecondaryColor), 4, 1);
            popup.gridAttachWidget(plug, new GenericLabel("Residence: ").setTextColor(textPrimaryColor), 0, 0);
            popup.gridAttachWidget(plug, new GenericLabel("Flag: ").setTextColor(textPrimaryColor), 0, 1);
            popup.gridAttachWidget(plug, new GenericLabel("Player: ").setTextColor(textPrimaryColor), 0, 2);
            popup.gridAttachWidget(plug, new GenericLabel("Group: ").setTextColor(textPrimaryColor), 0, 3);
            popup.gridAttachWidget("ResidenceName",plug, new GenericLabel(resname).setTextColor(textSecondaryColor), 1, 0);
            popup.gridAttachWidget(plug, new GenericLabel("Owner: ").setTextColor(textPrimaryColor), 0, 4);
            popup.gridAttachWidget(plug, new GenericLabel("World: ").setTextColor(textPrimaryColor), 0, 5);
            popup.gridAttachWidget(plug, new GenericLabel(res.getOwner()).setTextColor(textSecondaryColor), 1, 4);
            popup.gridAttachWidget(plug, new GenericLabel(res.getWorld()).setTextColor(textSecondaryColor), 1, 5);

            GenericTextField flag = new GenericTextField();
            flag.setTooltip("The name of the flag...");
            flag.setColor(textSecondaryColor);
            flag.setFieldColor(fieldcolor);
View Full Code Here

   *            Player f�r den das Label initialisiert wird
   */
  public void initBaseLabels(SpoutPlayer player) {

    // redBase Label
    GenericLabel redBaselabel = new GenericLabel("no base set");
    redBaselabel.setScale((float) 0.5);
    redBaselabel.setAnchor(WidgetAnchor.TOP_RIGHT);
    redBaselabel.setTextColor(new org.getspout.spoutapi.gui.Color(255, 0, 0));
    redBaselabel.shiftXPos(-70).shiftYPos(120);
    redBaselabel.setWidth(200).setHeight(10);
    ConflictPlugin.redBaseLabels.put(player, redBaselabel);

    if (null != ConflictPlugin.redBase) {
      redBaselabel.setText("Red Base: " + ConflictPlugin.redBase.koordsString());
    }

    player.getMainScreen().attachWidget(this, redBaselabel);

    // blueBase Label
    GenericLabel blueBaselabel = new GenericLabel("no base set");
    blueBaselabel.setScale((float) 0.5);
    blueBaselabel.setAnchor(WidgetAnchor.TOP_RIGHT);
    blueBaselabel.setTextColor(new org.getspout.spoutapi.gui.Color(0, 0, 255));
    blueBaselabel.shiftXPos(-70).shiftYPos(130);
    blueBaselabel.setWidth(200).setHeight(10);
    ConflictPlugin.blueBaseLabels.put(player, blueBaselabel);

    if (null != ConflictPlugin.blueBase) {
      blueBaselabel.setText("Blue Base: " + ConflictPlugin.blueBase.koordsString());
    }
    player.getMainScreen().attachWidget(this, blueBaselabel);

  }
View Full Code Here

   *
   * @param player
   *            Spieler
   */
  public void initDamageLabel(SpoutPlayer player) {
    GenericLabel damageLabel = new GenericLabel("Camping Damage: 0" + "/" + ConflictPlugin.damageTresholdForPlayer);
    damageLabel.setScale((float) 0.5);
    damageLabel.setAnchor(WidgetAnchor.TOP_RIGHT);
    // damageLabel.setTextColor(new org.getspout.spoutapi.gui.Color(0, 0, 255));
    damageLabel.shiftXPos(-70).shiftYPos(140);
    damageLabel.setWidth(200).setHeight(10);
    ConflictPlugin.damageLabels.put(player, damageLabel);
    player.getMainScreen().attachWidget(this, damageLabel);
  }
View Full Code Here

   *
   * @param player
   *            Spieler
   */
  public void initArtNumberLabel(SpoutPlayer player) {
    GenericLabel artNumberLabel1 = new GenericLabel(Integer.toString(ConflictPlugin.artRed));
    artNumberLabel1.setScale((float) 1.0);
    artNumberLabel1.setAnchor(WidgetAnchor.TOP_CENTER);
    artNumberLabel1.setTextColor(new org.getspout.spoutapi.gui.Color(255, 0, 0));
    artNumberLabel1.shiftXPos(-10).shiftYPos(10);
    artNumberLabel1.setWidth(200).setHeight(10);
    ConflictPlugin.artNumberLabelsRed.put(player, artNumberLabel1);
    player.getMainScreen().attachWidget(this, artNumberLabel1);

    GenericLabel artNumberLabel2 = new GenericLabel(Integer.toString(ConflictPlugin.artBlue));
    artNumberLabel2.setScale((float) 1.0);
    artNumberLabel2.setAnchor(WidgetAnchor.TOP_CENTER);
    artNumberLabel2.setTextColor(new org.getspout.spoutapi.gui.Color(0, 0, 255));
    artNumberLabel2.shiftXPos(10).shiftYPos(10);
    artNumberLabel2.setWidth(200).setHeight(10);
    ConflictPlugin.artNumberLabelsBlue.put(player, artNumberLabel2);
    player.getMainScreen().attachWidget(this, artNumberLabel2);

  }
View Full Code Here

    int y = (screenHeight / 2) - 100;
   
   

    GenericContainer buttons = new GenericContainer();
    GenericLabel title = new GenericLabel();
    WrappedGenericLabel body = new WrappedGenericLabel();
    GenericLabel copyright = new GenericLabel();
//    SelectorButton general = new SelectorButton( SelectorType.GENERAL, body);
//    SelectorButton rules = new SelectorButton( SelectorType.RULES, body);
//    SelectorButton commands = new SelectorButton( SelectorType.COMMANDS, body);
//    SelectorButton ranks = new SelectorButton( SelectorType.RANKS, body);
    ExitButton exit = new ExitButton();
    GenericTexture icons = new GenericTexture();
    GenericTexture background = new GenericTexture();

    // Button Icons
    icons.setX(x+7).setY(y+17);
    icons.setWidth(326).setHeight(20);
    icons.setUrl("https://github.com/LimeByte/SpoutHelp/raw/master/images/icons.png");
    icons.setPriority(RenderPriority.Normal);

    // Buttons
//    general.setMarginRight(4).setFixed(true);
//    rules.setMarginRight(4).setFixed(true);
//    commands.setMarginRight(4).setFixed(true);
//    ranks.setFixed(true);
    exit.setMarginLeft(214).setFixed(true);

    // Button Container
    //buttons.addChildren(general, rules, commands, ranks, exit);
    buttons.setX(x+7).setY(y+17);
    buttons.setWidth(326).setHeight(20);
    buttons.setLayout(ContainerType.HORIZONTAL);
    buttons.setAuto(false);
   
    buttons.setPriority(RenderPriority.High);

    // GUI Title
    title.setText("Skills");
    title.setX(x+7).setY(y+5);
    title.setWidth(100).setHeight(20);
    title.setFixed(false);
    title.setPriority(RenderPriority.High);

    // Body Text
    body.setX(x+10).setY(y+44);
    body.setWidth(320).setHeight(136);
    //body.setText(general.getTopicText());
    body.setDirty(true);
    body.setPriority(RenderPriority.High);

    // Copyright Text
    copyright.setTextColor(new Color("8B8B8B"));
    copyright.setShadow(false);
    copyright.setX(x+284).setY(y+186);
    copyright.setWidth(100).setHeight(18);
    copyright.setFixed(false);
    copyright.setText("SpoutHelp");
    copyright.setPriority(RenderPriority.High);

    // Main GUI
    background.setX(x).setY(y);
    background.setWidth(340).setHeight(200);
    background.setFixed(false);
View Full Code Here

TOP

Related Classes of org.getspout.spoutapi.gui.GenericLabel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.