use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class DrawMaster method draw.
public void draw(CellComp cellComp, Graphics compGraphics, int zoom, boolean editorMode) {
this.cellComp = cellComp;
this.zoom = zoom;
initSizes();
Map<Rectangle, Object> mouseMap = new XLinkedMap<>();
cellComp.setMouseMap(mouseMap);
Unit topObj = cellComp.getTopObj();
if (isSingleObj()) {
Image image = cellComp.getGame().getVisionMaster().getVisibilityMaster().getDisplayImageForUnit(topObj);
if (image != null) {
compGraphics.drawImage(image, 0, 0, null);
if (topObj.isWall()) {
drawWallOverlays(topObj, compGraphics, cellComp.getCoordinates());
}
if (GRAPHICS_TEST_MODE) {
DC_Obj obj = cellComp.getTopObjOrCell();
drawCI(obj, compGraphics);
if (FULL_GRAPHICS_TEST_MODE) {
compGraphics.drawString("" + obj.getOutlineType(), 0, GuiManager.getCellHeight() - 40);
String tooltip = cellComp.getGame().getVisionMaster().getHintMaster().getTooltip(obj);
if (tooltip != null) {
compGraphics.drawString("" + tooltip, 0, GuiManager.getCellHeight() - 20);
}
drawSightBlockInfo(cellComp, compGraphics, zoom);
}
}
drawSpecialOverlays(cellComp, compGraphics, zoom);
return;
}
}
// no overlays at all? Animations at least?
if (isFramePaintZoom()) {
if (!isMultiObj()) {
try {
drawCellFrame(compGraphics);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
if (!cellComp.isTerrain()) {
try {
drawObjComps(compGraphics);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
} else {
try {
drawTerrainObj(compGraphics);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
if (!cellComp.isTerrain()) {
if (topObj.isInfoSelected() || topObj.isActiveSelected()) {
BufferedImage compOverlayImage = ImageManager.getNewBufferedImage(getCompWidth(), getCompHeight());
drawComponentOverlays(compOverlayImage.getGraphics());
BfGridComp.getOverlayMap().put(new XLine(new Point(topObj.getX(), topObj.getY()), new Point(5 - getObjCount() * 2, 0)), compOverlayImage);
} else {
drawComponentOverlays(compGraphics);
}
}
drawOverlayingObjects(compGraphics, cellComp);
// perhaps should work with Obj instead?
if (isAnimationPaintZoom()) {
if (cellComp.isAnimated()) {
try {
drawAnimations(cellComp, compGraphics);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
if (GRAPHICS_TEST_MODE) {
drawCI(topObj, compGraphics);
}
if (GRAPHICS_TEST_MODE || isEditorMode() || DC_Game.game.isDebugMode()) {
Coordinates coordinates = cellComp.getCoordinates();
BfGridComp grid = cellComp.getGrid();
if (grid == null) {
grid = cellComp.getGame().getBattleField().getGrid().getGridComp();
}
if (coordinates.x - grid.getOffsetX() == 0) {
drawCoordinateMarkings(coordinates.y, compGraphics, false);
}
if (coordinates.y - grid.getOffsetY() == 0) {
drawCoordinateMarkings(coordinates.x, compGraphics, true);
}
if (cellComp.isInfoSelected()) {
drawCoordinateMarkings(coordinates.x, compGraphics, true);
drawCoordinateMarkings(coordinates.y, compGraphics, false);
}
}
if (isSightVisualsOn()) {
// Unit obj = cellComp.getGame().getManager().getActiveObj();
// // if (!obj.isMine()) return ;
// boolean extended = !obj.getSightSpectrumCoordinates(false).contains(
// cellComp.getCoordinates());
// if (!extended) {
// extended = obj.getSightSpectrumCoordinates(true)
// .contains(cellComp.getCoordinates());
// if (!extended) {
// return;
// }
// }
//
// drawSightVisualsOnCell((Graphics2D) compGraphics, extended, cellComp.getObjects().size() > 0);
// drawSightBlockInfo(cellComp, compGraphics, zoom);
}
drawSpecialOverlays(cellComp, compGraphics, zoom);
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class VersionMaster method readVersionFile.
private static void readVersionFile(OBJ_TYPE t, String version) {
String xml = FileManager.readFile(getVersionFolderPath(t, version));
List<ObjType> types = XML_Reader.createCustomTypeList(xml, t, ArcaneTower.getSimulation(), false, false, false);
Map<String, ObjType> idMap = new XLinkedMap<>();
for (ObjType type : types) {
String id = type.getUniqueId();
idMap.put(id, type);
}
map.put(version, idMap);
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class ActionAnimation method getImageMapFromIds.
protected Map<Image, String> getImageMapFromIds(Attack attack, Map<MOD_IDENTIFIER, String> map) {
Map<Image, String> iconMap = new XLinkedMap<>();
subPhaseTypeMap = new XLinkedMap<>();
for (MOD_IDENTIFIER modId : map.keySet()) {
Image image = modId.getImage(map.get(modId), attack);
PHASE_TYPE phaseType = getSubPhaseTypeForKey(modId);
if (phaseType == null) {
getSubPhaseTooltipMap().put(image, getTooltip(modId));
}
subPhaseTypeMap.put(image, phaseType);
iconMap.put(image, map.get(modId));
}
return iconMap;
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class ActionAnimation method drawCosts.
protected boolean drawCosts(AnimPhase phase) {
int base = getDefaultIconMapOffsetY();
boolean invert = false;
Boolean edge;
boolean positive;
if (getTarget() == source || phase.isDrawOnSource()) {
edge = game.getBattleField().getGrid().isOnEdgeY(source.getCoordinates());
// TODO
positive = BooleanMaster.isTrue(edge) || edge == null;
base = getOffsetBase(positive);
if (base < 0) {
invert = true;
}
}
if (getTarget().getCoordinates().isAdjacent(source.getCoordinates())) {
if (PositionMaster.inLine(source, target)) {
if (PositionMaster.isAbove(target, source)) {
invert = true;
}
if (PositionMaster.isAbove(source, target)) {
invert = false;
}
}
}
Costs costs = (Costs) phase.getArgs()[0];
Map<Image, String> map = new XLinkedMap<>();
for (Cost s : costs.getCosts()) {
if (s.isPaidAlt()) {
s = s.getAltCost();
}
Formula formula = s.getPayment().getAmountFormula();
PARAMETER param = s.getPayment().getParamToPay();
Image image = ImageManager.getValueIcon(param);
if (image == null) {
continue;
}
String string = "" + (-s.getPayment().getLastPaid());
map.put(image, string);
List<String> list = new ArrayList<>();
list.add(string);
getSubPhaseTooltipMap().put(image, list);
}
drawIconMap(map, false, true, base, invert);
return true;
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class OptionsMaster method readOptions.
public static Map<OPTIONS_GROUP, Options> readOptions(String data) {
Document doc = XML_Converter.getDoc(data);
Map<OPTIONS_GROUP, Options> optionsMap = new XLinkedMap<>();
for (Node sub : XML_Converter.getNodeListFromFirstChild(doc, true)) {
OPTIONS_GROUP group = OPTIONS_GROUP.valueOf(sub.getNodeName());
Options options = createOptions(group, sub);
if (options != null)
optionsMap.put(group, options);
}
return optionsMap;
}
Aggregations