Пример #1
0
  public void update() {
    super.update();

    boolean enableDebug = Config.getInstance().isDebug();
    debugLine1.setVisible(enableDebug);
    debugLine2.setVisible(enableDebug);
    debugLine3.setVisible(enableDebug);
    debugLine4.setVisible(enableDebug);

    if (enableDebug) {
      CameraTargetSystem cameraTarget = CoreRegistry.get(CameraTargetSystem.class);
      double memoryUsage =
          ((double) Runtime.getRuntime().totalMemory() - (double) Runtime.getRuntime().freeMemory())
              / 1048576.0;
      Timer timer = CoreRegistry.get(Timer.class);
      debugLine1.setText(
          String.format(
              "fps: %.2f, mem usage: %.2f MB, total mem: %.2f, max mem: %.2f",
              timer.getFps(),
              memoryUsage,
              Runtime.getRuntime().totalMemory() / 1048576.0,
              Runtime.getRuntime().maxMemory() / 1048576.0));
      debugLine2.setText(String.format("%s", cameraTarget.toString()));
      debugLine3.setText(String.format("%s", CoreRegistry.get(WorldRenderer.class)));
      debugLine4.setText(
          String.format(
              "total vus: %s | active threads: %s",
              ChunkTessellator.getVertexArrayUpdateCount(),
              CoreRegistry.get(GameEngine.class).getActiveTaskCount()));
    }
  }
Пример #2
0
 private void resetInput() {
   // clear the textbowes
   txtzonename.setText("");
   txtheight.setText("");
   txtwidth.setText("");
   txtdepth.setText("");
   lblzonetype.setText("");
   lblError.setText("");
   newzonefound = false;
   btnSave.setVisible(false);
   btnDelete.setVisible(false);
 }
Пример #3
0
 private boolean checkSingleZone() {
   WorldProvider worldprovider = CoreRegistry.get(WorldProvider.class);
   Block block = worldprovider.getBlock(MinionSystem.getNewZone().getStartPosition());
   if (block.getURI().getFamily().matches("minionbench")) {
     MinionSystem.getNewZone().zonetype = ZoneType.Work;
     if (MinionSystem.getWorkZoneList() == null) {
       txtzonename.setText("Workzone0");
     } else {
       txtzonename.setText("Workzone" + MinionSystem.getWorkZoneList().size());
     }
     lblzonetype.setText("ZoneType : Workzone");
     newzonefound = true;
   } else if (block.getURI().getFamily().matches("chest")) {
     MinionSystem.getNewZone().zonetype = ZoneType.Storage;
     if (MinionSystem.getWorkZoneList() == null) {
       txtzonename.setText("Storage0");
     } else {
       txtzonename.setText("Storage" + MinionSystem.getWorkZoneList().size());
     }
     lblzonetype.setText("ZoneType : Storage");
     newzonefound = true;
   }
   return newzonefound;
 }
Пример #4
0
  private void fillUI() {
    initList();
    resetInput();

    if (MinionSystem.getNewZone() != null && MinionSystem.getNewZone().getEndPosition() == null) {
      if (checkSingleZone()) {
        Vector3i minbounds = MinionSystem.getNewZone().getMinBounds();
        Vector3i maxbounds = MinionSystem.getNewZone().getMaxBounds();
        txtwidth.setText("1");
        txtdepth.setText("1");
        txtheight.setText("1");
      }
    } else if (MinionSystem.getNewZone() != null
        && MinionSystem.getNewZone().getEndPosition() != null) {
      newzonefound = true;
      MinionSystem.getNewZone().zonetype = ZoneType.Gather;

      Vector3i minbounds = MinionSystem.getNewZone().getMinBounds();
      Vector3i maxbounds = MinionSystem.getNewZone().getMaxBounds();
      if (MinionSystem.getGatherZoneList() == null) {
        txtzonename.setText("Zone0");
      } else {
        txtzonename.setText(
            "Zone"
                + (MinionSystem.getGatherZoneList().size()
                    + MinionSystem.getTerraformZoneList().size()));
      }
      lblzonetype.setText("ZoneType :");
      cmbType.setVisible(true);
      txtwidth.setText("" + (getAbsoluteDiff(maxbounds.x, minbounds.x)));
      txtdepth.setText("" + (getAbsoluteDiff(maxbounds.z, minbounds.z)));
      txtheight.setText("" + (getAbsoluteDiff(maxbounds.y, minbounds.y)));
    }
    if (newzonefound) {
      if (MinionSystem.getNewZone().outofboundselection()) {
        btnSave.setVisible(true);
        lblError.setText(
            "The zone is to big to be saved, depth, width, height should not exceed 50");
      } else {
        btnSave.setVisible(true);
      }
      btnDelete.setVisible(false);
    }
  }
Пример #5
0
        @Override
        public void click(UIDisplayElement element, int button) {
          UIListItem listitem = (UIListItem) element;
          if (listitem.getValue().getClass().equals(ZoneType.class)) {
            switch (((ZoneType) listitem.getValue())) {
              case Gather:
                {
                  uizonelist.removeAll();
                  for (Zone zone : MinionSystem.getGatherZoneList()) {
                    UIListItem newlistitem = new UIListItem(zone.Name, zone);
                    newlistitem.setTextColor(Color.black);
                    newlistitem.addClickListener(zonelistener);
                    uizonelist.addItem(newlistitem);
                  }
                  uizonelistgroup.setVisible(false);
                  uizonelist.setVisible(true);
                  btnBack.setVisible(true);
                  break;
                }
              case Terraform:
                {
                  uizonelist.removeAll();
                  for (Zone zone : MinionSystem.getTerraformZoneList()) {
                    UIListItem newlistitem = new UIListItem(zone.Name, zone);
                    newlistitem.setTextColor(Color.black);
                    newlistitem.addClickListener(zonelistener);
                    uizonelist.addItem(newlistitem);
                  }
                  uizonelistgroup.setVisible(false);
                  uizonelist.setVisible(true);
                  btnBack.setVisible(true);
                  break;
                }
              case Work:
                {
                  uizonelist.removeAll();
                  for (Zone zone : MinionSystem.getWorkZoneList()) {
                    UIListItem newlistitem = new UIListItem(zone.Name, zone);
                    newlistitem.setTextColor(Color.black);
                    newlistitem.addClickListener(zonelistener);
                    uizonelist.addItem(newlistitem);
                  }
                  uizonelistgroup.setVisible(false);
                  uizonelist.setVisible(true);
                  btnBack.setVisible(true);
                  break;
                }
              case Storage:
                {
                  uizonelist.removeAll();
                  for (Zone zone : MinionSystem.getStorageZoneList()) {
                    UIListItem newlistitem = new UIListItem(zone.Name, zone);
                    newlistitem.setTextColor(Color.black);
                    newlistitem.addClickListener(zonelistener);
                    uizonelist.addItem(newlistitem);
                  }
                  uizonelistgroup.setVisible(false);
                  uizonelist.setVisible(true);
                  btnBack.setVisible(true);
                  break;
                }
              case OreonFarm:
                {
                  uizonelist.removeAll();
                  for (Zone zone : MinionSystem.getOreonFarmZoneList()) {
                    UIListItem newlistitem = new UIListItem(zone.Name, zone);
                    newlistitem.setTextColor(Color.black);
                    newlistitem.addClickListener(zonelistener);
                    uizonelist.addItem(newlistitem);
                  }
                  uizonelistgroup.setVisible(false);
                  uizonelist.setVisible(true);
                  btnBack.setVisible(true);
                  break;
                }
              default:
                {
                  break;
                }
            }
          } else {
            if (cmbType.isVisible()) {
              cmbType.setVisible(false);
            }
            lblError.setText("");
            Zone zone = (Zone) listitem.getValue();
            txtzonename.setText(zone.Name);
            txtheight.setText("" + zone.zoneheight);
            txtwidth.setText("" + zone.zonewidth);
            txtdepth.setText("" + zone.zonedepth);
            switch (zone.zonetype) {
              case Gather:
                {
                  lblzonetype.setText("Zonetype : Gather");
                  break;
                }
              case Terraform:
                {
                  lblzonetype.setText("Zonetype : Terraform");
                  break;
                }
              case Work:
                {
                  lblzonetype.setText("Zonetype : Work");
                  break;
                }
              default:
                {
                  lblzonetype.setText("label wasn't set");
                  break;
                }
            }

            btnSave.setVisible(false);
            btnDelete.setVisible(true);
          }
        }