Esempio n. 1
0
 /**
  * Instantiate the MapController with the given server map used.
  *
  * @param serverMap the server map containing the context and map
  */
 public ServerMapController(BW4TServerMap serverMap) {
   super(serverMap.getMap());
   this.serverMap = serverMap;
   getRenderSettings().setRenderEntityName(true);
   Dimensions size = serverMap.getContinuousSpace().getDimensions();
   getRenderSettings().setWorldDimensions((int) size.getWidth(), (int) size.getHeight());
 }
Esempio n. 2
0
 @Override
 public Set<ViewBlock> getVisibleBlocks() {
   Set<ViewBlock> blocks = new HashSet<>();
   for (Object block : serverMap.getContext().getObjects(Block.class)) {
     blocks.add(((Block) block).getView());
   }
   return blocks;
 }
Esempio n. 3
0
 @Override
 public int getSequenceIndex() {
   Set<DropZone> dropZone = serverMap.getObjectsFromContext(DropZone.class);
   if (dropZone.size() <= 0) {
     return 0;
   }
   return dropZone.iterator().next().getSequenceIndex();
 }
Esempio n. 4
0
 @Override
 public List<BlockColor> getSequence() {
   Set<DropZone> dropZone = serverMap.getObjectsFromContext(DropZone.class);
   if (dropZone.size() <= 0) {
     return new ArrayList<>();
   }
   return dropZone.iterator().next().getSequence();
 }
Esempio n. 5
0
 @Override
 public Set<ViewEPartner> getVisibleEPartners() {
   Set<ViewEPartner> epartners = new HashSet<>();
   for (Object epartner : serverMap.getContext().getObjects(EPartner.class)) {
     EPartner epartnerTemp = (EPartner) epartner;
     epartners.add(epartnerTemp.getView());
   }
   return epartners;
 }
Esempio n. 6
0
 @Override
 public Set<Path> getPaths() {
   Set<Path> paths = new HashSet<Path>();
   for (Object pathTemp : serverMap.getContext().getObjects(Path.class)) {
     Path path = (Path) pathTemp;
     paths.add(path);
   }
   return paths;
 }
Esempio n. 7
0
 @Override
 public boolean isOccupied(Zone room) {
   for (Object roomObj : serverMap.getContext().getObjects(Room.class)) {
     Room sroom = (Room) roomObj;
     if (sroom.getName().equals(room.getName())) {
       return sroom.getOccupier() != null;
     }
   }
   return false;
 }
Esempio n. 8
0
 @Override
 public Set<ViewEntity> getVisibleEntities() {
   Set<ViewEntity> entities = new HashSet<>();
   for (Object robot : serverMap.getContext().getObjects(IRobot.class)) {
     IRobot robotTemp = (IRobot) robot;
     if (robotTemp.isConnected()) {
       entities.add(robotTemp.getView());
     }
   }
   return entities;
 }