use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class HC_Tree method drawLink.
protected void drawLink(Graphics g, StaticTreeLink link) {
LIGHTING_VERSION lighting = LIGHTING_VERSION.DARKENED;
for (ObjType c : link.getChildren()) {
if (map.getNodeForType(c) == null) {
continue;
}
if (map.getNodeForType(c).isAcquired()) {
lighting = LIGHTING_VERSION.NORMAL;
break;
}
if (!CoreEngine.isArcaneVault()) {
if (map.getNodeForType(c).isAvailable()) {
lighting = LIGHTING_VERSION.AVAILABLE;
break;
}
}
if (map.getNodeForType(c).isSelected()) {
lighting = LIGHTING_VERSION.HIGHLIGHTED;
break;
}
// 2+ only in skills? Well also in GroupNodes so far...
}
drawLink(g, link, lighting);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class HC_Tree method drawText.
protected void drawText(Graphics g) {
for (Point p : textMap.keySet()) {
SmartText smartText = textMap.get(p);
g.setFont(smartText.getFont());
g.setColor(smartText.getColor());
g.drawString(smartText.getText(), p.x, p.y);
}
if (isNodeNamesDrawn()) {
Font defaultFont = getDefaultFont();
for (Point p : map.getNodeMap().keySet()) {
int wrapLength = 15;
ObjType type = map.getNodeMap().get(p).getType();
String text = type.getName();
List<String> list = TextWrapper.wrap(text, wrapLength);
int width = FontMaster.getStringLengthForWidth(defaultFont, Math.min(wrapLength, text.length()));
int offsetX = (width - map.getNodeSize()) / 2;
int x = Math.max(p.x - offsetX, 0);
// boolean hasOverlap = false;
int offsetY = 5;
// lower if overlap
int y = Math.max(p.y - offsetY, 0);
int fontHeight = FontMaster.getFontHeight(defaultFont) + 3;
int height = list.size() * fontHeight + 5;
List<ObjType> overlapping = map.getTypesWithinRange(type, 0, 0, x, y, Math.max(20, (width - map.getNodeSize())), fontHeight * 3 / 2);
if (y < 5) {
y = 5;
}
if (x <= offsetX) {
x = offsetX;
}
if (overlapping.size() > 0) {
LogMaster.log(1, type + " has " + overlapping);
y += map.getNodeSize() + offsetY * 2;
while (overlapping.size() > 0) {
y += fontHeight;
if (y >= map.getDimension().height) {
y -= fontHeight;
break;
}
overlapping = map.getTypesWithinRange(type, 0, 0, x, y, Math.max(20, (width - map.getNodeSize())), fontHeight * 3 / 2);
LogMaster.log(1, type + " has " + overlapping);
}
while (overlapping.size() > 0) {
y -= fontHeight;
if (y <= offsetY) {
y = offsetY;
break;
}
overlapping = map.getTypesWithinRange(type, 0, 0, x, y, Math.max(20, (width - map.getNodeSize())), fontHeight * 3 / 2);
LogMaster.log(1, type + " has " + overlapping);
}
}
// height += offsetY;
g.setColor(ColorManager.getTranslucent(getTipBackgroundColor(), 90));
g.fillRect(x - 12, y - 12, width, height);
for (String str : list) {
g.setColor(getTextColor());
g.drawString(str, x, y);
y += fontHeight;
}
}
}
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class ClassTreeBuilder method addMulticlassNodes.
private void addMulticlassNodes(ObjType type) {
if (map.getPointForType(type) == null) {
return;
}
boolean multiclass = DC_ContentManager.isMulticlass(type);
List<ObjType> children = DataManager.getChildren(type, DC_ContentManager.getMulticlassTypes(), (multiclass ? G_PROPS.BASE_TYPE : PROPS.BASE_CLASSES_ONE), G_PROPS.NAME);
int i = 0;
initGroups(children);
for (ObjType c : children) {
if (children.size() == 1) {
if (!c.checkProperty(PROPS.LINK_VARIANT)) {
c.setProperty(PROPS.LINK_VARIANT, LINK_VARIANT.VERTICAL_LONG.toString());
}
}
addNodeBranch(c, map.getPointForType(type).x, i, children.size(), type);
i++;
map.getTypes().add(c);
}
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class HT_MapBuilder method addNodeBranch.
protected void addNodeBranch(ObjType root, int parentX, int i, int sublingCount, ObjType parent) {
// int
int newParentX = addNode(parentX, root, i, sublingCount, parent);
List<ObjType> children = DataManager.getChildren(root, data);
if (children.isEmpty()) {
return;
}
i = 0;
sortDefault(children);
LogMaster.log(1, root.getName() + " has children: " + children);
for (ObjType child : children) {
sublingCount = getSublingCount(children);
addNodeBranch(child, newParentX, i, sublingCount, root);
if (sublingCount < children.size()) {
if (isRowPosIgnored(child)) {
continue;
}
}
i++;
}
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class HT_MapBuilder method build.
public TreeMap build() {
initData();
map = new TreeMap(data, maxWidth, maxHeight);
// first, break the types into groups perhaps!
List<ObjType> rootTypes = DataManager.getRootTypes(data);
List<ObjType> customPosTypes = getCustomPosTypes(rootTypes);
rootTypes.removeAll(customPosTypes);
initGroups(data);
sortDefault(rootTypes);
LogMaster.log(1, "Building tree for " + arg + "... \n rootTypes== " + rootTypes);
// TODO next row of root types!
if (rootTypes.size() > 3) {
if (rootTypes.size() > 4) {
marginX = 38;
} else {
marginX = 28;
}
}
for (ObjType rootType : rootTypes) {
int x = marginX + columns[column] * defSize * 2 - defSize / 2;
if (column == 3) {
x += 30;
} else if (column == 4) {
x -= 30;
}
addNodeBranch(rootType, x, column, 0, null);
column++;
if (column >= maxRows) {
column = 0;
// TODO preCheck row has enough free Y space for this skill-line
}
// y still determined by sd? perhaps not always, some *aligning*
// would be good only non-basic roots?
}
for (ObjType customPosType : customPosTypes) {
setCustomPos(true);
int x = customPosType.getIntParam(PARAMS.HT_CUSTOM_POS_X);
addNodeBranch(customPosType, x, -1, -1, null);
// addNode(parentX, type, i, sublingCount, parent)
}
addAltBaseLinks();
LogMaster.log(1, "Tree built for " + arg + ": \n " + map);
return map;
/*
* let links have offset space within 64 pixels!
*
* re-build map with random root-sorting ?
* save best order...
*
* after-adjustment:
* >> changing links will affect children... unless I automatically balance with Short Link (and long for the 'neighbors')
*
*
*
*
*
*/
}
Aggregations