public void defTerri(Zone p, int i, Image img) {
    List<Coordonnees> temp = new ArrayList<Coordonnees>();
    temp = game.getZone(new Coordonnees(p.getX(), p.getY()), i);

    for (Coordonnees c : temp) {
      panelPere.getListTerri().add(new Zone(c.getX(), c.getY(), img));
    }
  }
 @Test
 public void unmarshallXmlSnippet() throws JAXBException {
   String xml = "<zone x=\"21\" y=\"12\" nvt=\"1\" tag=\"5\" danger=\"1\"/>";
   Zone zone = (Zone) XmlToObjectConverter.convertXmlToObject(xml, Zone.class);
   assertEquals(21, zone.getX());
   assertEquals(12, zone.getY());
   assertEquals(true, zone.getDiscoveredNotVisitedToday());
   assertEquals(ZoneTag.DEPLETED, zone.getTag());
   assertEquals(-1, zone.getZombies());
   assertEquals(ZoneDanger.ONE_TO_THREE, zone.getDanger());
 }
  @Override
  public void mouseClicked(MouseEvent e) {
    Point p = new Point(Paint.pxtoHex(e.getX(), e.getY()));
    if (verifPresence(p.x, p.y) == 1) {
      panelPere.getListDeplacement().clear();
      panelPere.repaint();
      for (Troupes z : getListUnit()) {
        if (z.getCo().getX() == p.x && z.getCo().getY() == p.y) {
          this.SelectionTemp = z;
          panelPere.afficherDeplacement(z);
          panelPere.repaint();
        }
      }
    } else if (verifPresence(p.x, p.y) == 2) {
      afficherOptionVille();
    } else if ((verifPresence(p.x, p.y) == 0) && SelectionTemp != null) {
      for (Zone z : panelPere.getListDeplacement()) {
        if (z.getX() == p.x && z.getY() == p.y) {
          for (Troupes t : getListUnit()) {
            if (t.getCo().getX() == SelectionTemp.getCo().getX()
                && t.getCo().getY() == SelectionTemp.getCo().getY()) {
              t.getCo().setX(p.x);
              t.getCo().setY(p.y);
              repaint();
            }
          }
        }
      }
      panelPere.getListDeplacement().clear();
      panelPere.repaint();
      SelectionTemp = null;
    } else if ((verifPresence(p.x, p.y) == 0) && SelectionTemp == null) {
      panelPere.getListDeplacement().clear();
      panelPere.repaint();
      if (verifCarte(p.x, p.y)) {
        addUnit(p.x, p.y);
      }
    }

    if (!(e.getX() < 30
        || e.getY() < 30
        || e.getX() >= f.getWidth()
        || e.getY() >= f.getHeight())) {
      Image img;
      try {
        img = ImageIO.read(new File("./ressources/images/unit/SelectorYellow.png"));
        Zone z = new Zone(p.x, p.y, img);
        panelPere.setSelect(z);
      } catch (IOException e1) {
        e1.printStackTrace();
      }
      panelPere.repaint();
    }
  }
 @Test
 public void constructorTest() {
   Zone zone =
       new ZoneBuilder()
           .setX(-10)
           .setY(5)
           .setZoneDepleted(true)
           .setBuildingDepleted(true)
           .setBluePrintRetrieved(true)
           .setScoutPeek("Rolly's Rotor House")
           .setCampingTopology(CampingTopology.L2_SHORTAGE)
           .setZombies(19)
           .toZone();
   assertEquals(-10, zone.getX());
   assertEquals(5, zone.getY());
   assertEquals(true, zone.isBluePrintRetrieved());
   assertEquals(true, zone.isZoneDepleted());
   assertEquals(true, zone.isBuildingDepleted());
   assertEquals(CampingTopology.L2_SHORTAGE, zone.getCampingTopology());
   assertEquals("Rolly's Rotor House", zone.getScoutPeek());
   assertEquals(19, zone.getZombies());
 }
Example #5
0
 public void setZone(Zone zone) {
   this.zone = zone;
   this.setX(zone.getX());
   this.setY(zone.getY());
   this.setLayoutParams(new ViewGroup.LayoutParams(zone.getWidth(), zone.getWidth()));
 }