gpt4 book ai didi

net.rptools.maptool.model.Zone类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:08:22 29 4
gpt4 key购买 nike

本文整理了Java中net.rptools.maptool.model.Zone类的一些代码示例,展示了Zone类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zone类的具体详情如下:
包路径:net.rptools.maptool.model.Zone
类名称:Zone

Zone介绍

[英]This object represents the maps that will appear for placement of Tokens.

Note: When adding new fields to this class, make sure to add functionality to the constructor, #imported(), #optimize(), and #readResolve() to ensure they are properly initialized for maximum compatibility.
[中]此对象表示将出现用于放置令牌的地图。
注意:向此类添加新字段时,请确保向构造函数、#imported()、#optimize()和#readResolve()添加功能,以确保它们正确初始化以实现最大兼容性。

代码示例

代码示例来源:origin: RPTools/maptool

public static Zone createZone() {
  Zone zone = new Zone();
  zone.setName(DEFAULT_MAP_NAME);
  zone.setBackgroundPaint(new DrawableTexturePaint(defaultImageId));
  zone.setFogPaint(new DrawableColorPaint(Color.black));
  zone.setVisible(AppPreferences.getNewMapsVisible());
  zone.setHasFog(AppPreferences.getNewMapsHaveFOW());
  zone.setUnitsPerCell(AppPreferences.getDefaultUnitsPerCell());
  zone.setTokenVisionDistance(AppPreferences.getDefaultVisionDistance());
  zone.setGrid(GridFactory.createGrid(AppPreferences.getDefaultGridType(), AppPreferences.getFaceEdge(), AppPreferences.getFaceVertex()));
  zone.setGridColor(AppPreferences.getDefaultGridColor().getRGB());
  zone.getGrid().setSize(AppPreferences.getDefaultGridSize());
  zone.getGrid().setOffset(0, 0);
  return zone;
}

代码示例来源:origin: RPTools/maptool

public void setZone(Zone zone) {
  if (zone != null) {
    zone.removeModelChangeListener(this);
  }
  this.zone = zone;
  update();
  if (zone != null) {
    zone.addModelChangeListener(this);
  }
}

代码示例来源:origin: RPTools/maptool

public void clearAllDrawings(GUID zoneGUID, Zone.Layer layer) {
  Zone zone = server.getCampaign().getZone(zoneGUID);
  List<DrawnElement> list = zone.getDrawnElements(layer);
  zone.clearDrawables(list); // FJE Empties the DrawableUndoManager and empties the list
  forwardToAllClients();
}

代码示例来源:origin: RPTools/maptool

private void setZone(Zone z) {
  setList(z.getInitiativeList());
  if (zone != null) {
    zone.removeModelChangeListener(this);
  }
  zone = z;
  zone.addModelChangeListener(this);
}

代码示例来源:origin: RPTools/maptool

public Campaign(Campaign campaign) {
  zones = Collections.synchronizedMap(new LinkedHashMap<GUID, Zone>());
  /*
   * JFJ 2010-10-27 Don't forget that since these are new zones AND new tokens created here from the old one, if
   * you have any data that needs to transfer over you will need to manually copy it as is done below for the
   * campaign properties and macro buttons.
   */
  for (Entry<GUID, Zone> entry : campaign.zones.entrySet()) {
    Zone copy = new Zone(entry.getValue());
    zones.put(copy.getId(), copy);
  }
  campaignProperties = new CampaignProperties(campaign.campaignProperties);
  macroButtonProperties = new ArrayList<MacroButtonProperties>(campaign.getMacroButtonPropertiesArray());
}

代码示例来源:origin: RPTools/maptool

if (renderer != null && renderer != MapTool.getFrame().getCurrentZoneRenderer() && (renderer.getZone().isVisible() || MapTool.getPlayer().isGM())) {
  MapTool.getFrame().setCurrentZoneRenderer(renderer);
Zone.Layer layer = (Zone.Layer) parameters[1];
zone = MapTool.getCampaign().getZone(zoneGUID);
zone.getDrawnElements(layer).clear();
zone.setHasFog(hasFog);
zone.exposeArea(area, selectedToks);
MapTool.getFrame().refresh();
return;
zone.setFogArea(area, selectedToks);
MapTool.getFrame().refresh();
return;
zone.hideArea(area, selectedToks);
MapTool.getFrame().refresh();
return;
if (MapTool.getFrame().getCurrentZoneRenderer() == null && zone.isVisible()) {
  MapTool.getFrame().setCurrentZoneRenderer(renderer);
zone = MapTool.getCampaign().getZone(zoneGUID);
Token token = (Token) parameters[1];
zone.putToken(token);
MapTool.getFrame().refresh();
return;

代码示例来源:origin: RPTools/maptool

/**
   * This is a convenience method to send the VBL Area to be rendered to the
   * server
   * 
   * @param renderer
   *            Reference to the ZoneRenderer
   * @param area
   *            A valid Area containing VBL polygons
   * @param erase
   *            Set to true to erase the VBL, otherwise draw it
   */
  private void renderVBL(ZoneRenderer renderer, Area area, boolean erase) {
    if (erase) {
      renderer.getZone().removeTopology(area);
      MapTool.serverCommand().removeTopology(renderer.getZone().getId(), area);
    } else {
      renderer.getZone().addTopology(area);
      MapTool.serverCommand().addTopology(renderer.getZone().getId(), area);
    }
    renderer.repaint();
  }
}

代码示例来源:origin: RPTools/maptool

addModelChangeListener(undo);
setName(zone.getName());
  Iterator<GUID> i = zone.labels.keySet().iterator();
  while (i.hasNext()) {
    this.putLabel(new Label(zone.labels.get(i.next())));
      token.setExposedAreaGUID(guid);
      ExposedAreaMetaData eamd = zone.getExposedAreaMetaData(old.getExposedAreaGUID());
      if (eamd != null)
        exposeArea(eamd.getExposedAreaHistory(), token);
    putToken(token);
    List<Integer> list = zone.initiativeList.indexOf(old);
    for (Integer integer : list) {

代码示例来源:origin: RPTools/maptool

if (functionName.equals("getCurrentMapName")) {
  checkNumberOfParameters(functionName, parameters, 0, 0);
  return MapTool.getFrame().getCurrentZoneRenderer().getZone().getName();
} else if (functionName.equals("setCurrentMap")) {
  checkTrusted(functionName);
  if (parameters.size() > 0) {
    String mapName = parameters.get(0).toString();
    return getNamedMap(functionName, mapName).getZone().isVisible() ? "1" : "0";
  } else {
    return MapTool.getFrame().getCurrentZoneRenderer().getZone().isVisible() ? "1" : "0";
  zone.setVisible(visible);
  MapTool.serverCommand().setZoneVisibility(zone.getId(), zone.isVisible());
  MapTool.getFrame().getZoneMiniMapPanel().flush();
  MapTool.getFrame().repaint();
  return zone.isVisible() ? "1" : "0";
  String newMapName = parameters.get(1).toString();
  Zone zone = getNamedMap(functionName, oldMapName).getZone();
  zone.setName(newMapName);
  MapTool.serverCommand().renameZone(zone.getId(), newMapName);
  if (zone == MapTool.getFrame().getCurrentZoneRenderer().getZone())
    MapTool.getFrame().setCurrentZoneRenderer(MapTool.getFrame().getCurrentZoneRenderer());
  return zone.getName();
  String newName = parameters.get(1).toString();
  Zone oldMap = getNamedMap(functionName, oldName).getZone();

代码示例来源:origin: RPTools/maptool

public void actionPerformed(ActionEvent e) {
    List<DrawnElement> drawableList = renderer.getZone().getAllDrawnElements();
    Iterator<DrawnElement> iter = drawableList.iterator();
    while (iter.hasNext()) {
      DrawnElement de = iter.next();
      if (selectedDrawSet.contains(de.getDrawable().getId())) {
        renderer.getZone().removeDrawable(de.getDrawable().getId());
        MapTool.serverCommand().undoDraw(renderer.getZone().getId(), de.getDrawable().getId());
        renderer.getZone().addDrawable(new DrawnElement(de.getDrawable(), de.getPen()));
        MapTool.serverCommand().draw(renderer.getZone().getId(), de.getPen(), de.getDrawable());
      }
    }
    MapTool.getFrame().updateDrawTree();
    MapTool.getFrame().refresh();
  }
}

代码示例来源:origin: RPTools/maptool

@Override
  public void execute(ActionEvent e) {
    Zone zone = MapTool.getFrame().getCurrentZoneRenderer().getZone();
    // XXX Perhaps ask the user if the copied map should have its GEA and/or TEA cleared?  An imported map would ask...
    String zoneName = JOptionPane.showInputDialog("New map name:", "Copy of " + zone.getName());
    if (zoneName != null) {
      Zone zoneCopy = new Zone(zone);
      zoneCopy.setName(zoneName);
      MapTool.addZone(zoneCopy);
    }
  }
};

代码示例来源:origin: RPTools/maptool

/**
 * Set the zone that we are currently working on.
 * 
 * @param aZone
 *            The new zone
 */
public void setZone(Zone aZone) {
  // Clean up listeners
  if (aZone == zone)
    return;
  if (zone != null)
    zone.removeModelChangeListener(this);
  zone = aZone;
  if (zone != null)
    zone.addModelChangeListener(this);
  // Older campaigns didn't have a list, make sure this one does
  InitiativeList list = (zone != null) ? zone.getInitiativeList() : new InitiativeList(null);
  if (list == null) {
    list = new InitiativeList(zone);
    zone.setInitiativeList(list);
  } // endif
  // Set the list and actions
  setList(list);
  displayList.getSelectionModel().clearSelection();
  updateView();
}

代码示例来源:origin: RPTools/maptool

public void actionPerformed(ActionEvent e) {
    List<DrawnElement> drawableList = renderer.getZone().getAllDrawnElements();
    Iterator<DrawnElement> iter = drawableList.iterator();
    while (iter.hasNext()) {
      DrawnElement de = iter.next();
      if (selectedDrawSet.contains(de.getDrawable().getId())) {
        renderer.getZone().removeDrawable(de.getDrawable().getId());
        renderer.getZone().addDrawableRear(de);
      }
    }
    // horrid kludge needed to redraw zone :(
    for (DrawnElement de : renderer.getZone().getAllDrawnElements()) {
      MapTool.serverCommand().undoDraw(renderer.getZone().getId(), de.getDrawable().getId());
      MapTool.serverCommand().draw(renderer.getZone().getId(), de.getPen(), de.getDrawable());
    }
    MapTool.getFrame().updateDrawTree();
    MapTool.getFrame().refresh();
  }
}

代码示例来源:origin: RPTools/maptool

if ((map.zone.getExposedArea() != null && !map.zone.getExposedArea().isEmpty())
    || (map.zone.getExposedAreaMetaData() != null && !map.zone.getExposedAreaMetaData().isEmpty())) {
  boolean ok = MapTool.confirm("<html>Map contains exposed areas of fog.<br>Do you want to reset all of the fog?");
  if (ok == true) {
    map.zone.clearExposedArea();

代码示例来源:origin: RPTools/maptool

/**
 * Note: When adding new fields to this class, make sure to update all
 * constructors, {@link #imported()}, {@link #readResolve()}, and
 * potentially {@link #optimize()}.
 */
public Zone() {
  // TODO: Was this needed?
  //		setGrid(new SquareGrid());
  undo = new UndoPerZone(this); // registers as ModelChangeListener for drawables...
  addModelChangeListener(undo);
}

代码示例来源:origin: RPTools/maptool

public static void exposePCArea(ZoneRenderer renderer) {
  Set<GUID> tokenSet = new HashSet<GUID>();
  List<Token> tokList = renderer.getZone().getPlayerTokens();
  String playerName = MapTool.getPlayer().getName();
  boolean isGM = MapTool.getPlayer().getRole() == Role.GM;
  for (Token token : tokList) {
    if (!token.getHasSight()) {
      continue;
    }
    boolean owner = token.isOwner(playerName) || isGM;
    if ((!MapTool.isPersonalServer() || MapTool.getServerPolicy().isUseIndividualViews()) && !owner) {
      continue;
    }
    tokenSet.add(token.getId());
  }
  renderer.getZone().clearExposedArea(); // Was clearExposedArea(tokenSet)
  exposeVisibleArea(renderer, tokenSet);
}

代码示例来源:origin: RPTools/maptool

public void testConversion() throws Exception {
    ZoneRenderer renderer = ZoneRendererFactory.newRenderer(new Zone());
    renderer.moveViewBy(-100, -100);

    for (int i = -10; i < 10; i++) {
      for (int j = -10; j < 10; j++) {
        ZonePoint zp = new ZonePoint(i, j);
        assertEquals(zp, ScreenPoint.fromZonePoint(renderer, zp).convertToZone(renderer));
      }
    }
  }
}

代码示例来源:origin: RPTools/maptool

public void draw(GUID zoneGUID, Pen pen, Drawable drawable) {
  server.getConnection().broadcastCallMethod(ClientCommand.COMMAND.draw.name(), RPCContext.getCurrent().parameters);
  Zone zone = server.getCampaign().getZone(zoneGUID);
  zone.addDrawable(new DrawnElement(drawable, pen));
}

代码示例来源:origin: RPTools/maptool

/**
 * Clear out any drawables that are hidden/erased. This is an optimization
 * step that should only happen when you can't undo your changes and
 * re-expose a drawable, typically at load.
 */
private void collapseDrawables() {
  collapseDrawableLayer(drawables);
  collapseDrawableLayer(gmDrawables);
  collapseDrawableLayer(objectDrawables);
  collapseDrawableLayer(backgroundDrawables);
}

代码示例来源:origin: RPTools/maptool

public void addTopology(GUID zoneGUID, Area area) {
  Zone zone = server.getCampaign().getZone(zoneGUID);
  zone.addTopology(area);
  forwardToClients();
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com