use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class LE_MapMaster method moveZone.
public void moveZone(MapZone zone) {
SoundMaster.playStandardSound(STD_SOUNDS.FAIL);
Coordinates c = pickCoordinate();
int offsetX = c.x - zone.getX1();
int offsetY = c.y - zone.getY1();
for (MapBlock b : zone.getBlocks()) {
moveBlock(b, offsetX, offsetY);
}
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class LE_MapMaster method replace.
public void replace(String prevFiller, String filler, List<Coordinates> coordinates) {
LevelEditor.getCurrentLevel().removeObj(prevFiller, coordinates.toArray(new Coordinates[coordinates.size()]));
ObjType type = DataManager.getType(filler);
for (Coordinates c : coordinates) {
// LevelEditor.getObjMaster().removeObj(c);
LevelEditor.getObjMaster().addObj(type, c);
}
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class LE_MapMaster method loadBlock.
public void loadBlock(MapBlock block) {
if (block == null) {
return;
}
Coordinates c = pickCoordinate();
int offsetX = -CoordinatesMaster.getMinX(block.getCoordinates()) + c.x;
int offsetY = -CoordinatesMaster.getMinY(block.getCoordinates()) + c.y;
List<Coordinates> coordinates = CoordinatesMaster.getCoordinatesWithOffset(block.getCoordinates(), offsetX, offsetY);
// coordinates=CoordinatesMaster.getCoordinatesWithin(c.x, , c.y, y1);
this.block = new MapBlock(getPlan().getBlocks().size(), block.getType(), getPlan().getZones().get(0), getPlan(), coordinates);
// should add to this.block
clearArea(coordinates);
for (Obj obj : block.getObjects()) {
// beware deadlock
LevelEditor.getCurrentLevel().setInitialized(false);
try {
Coordinates newCoordinates = new Coordinates(obj.getCoordinates().x + offsetX, obj.getCoordinates().y + offsetY);
obj.setCoordinates(newCoordinates);
LevelEditor.getObjMaster().addObj(obj.getType(), obj.getCoordinates());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
} finally {
LevelEditor.getCurrentLevel().setInitialized(true);
}
}
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class LE_MapMaster method clearArea.
public void clearArea(List<Coordinates> coordinates, boolean ignoreBlockChoice) {
if (!ignoreBlockChoice) {
ArrayList<MapBlock> blocks = new ArrayList<>();
for (Coordinates c : CoordinatesMaster.getCornerCoordinates(coordinates)) {
MapBlock b = getLevel().getBlockForCoordinate(c, true, blocks);
if (b != null) {
if (!blocks.contains(b)) {
blocks.add(b);
}
}
}
if (blocks.size() > 1) {
XList<Object> list = new XList<>(blocks.toArray());
list.add(0, "New");
list.add("Fit for each");
int i = DialogMaster.optionChoice(list.toArray(), "Which block to add coordinates to?");
if (i > 0 && i != list.size() - 1) {
setBlock(blocks.get(i - 1));
} else {
if (i == 0) {
if (DialogMaster.confirm("Create new block?")) {
newRoom(coordinates);
}
}
}
}
}
try {
LE_ObjMaster.removeObjects(coordinates);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
} finally {
setBlock(null);
}
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class LE_MouseMaster method pickCoordinate.
public Coordinates pickCoordinate() {
coordinateListeningMode = true;
// comp.refresh();
SoundMaster.playStandardSound(STD_SOUNDS.CLICK_ACTIVATE);
boolean result = (boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.CUSTOM_SELECT);
coordinateListeningMode = false;
if (!result) {
SoundMaster.playStandardSound(STD_SOUNDS.CLICK_ERROR);
return null;
}
SoundMaster.playStandardSound(STD_SOUNDS.CLICK_TARGET_SELECTED);
Coordinates coordinates = coordinateListeningObj.getCoordinates();
return coordinates;
}
Aggregations