use of eidolons.libgdx.bf.grid.GridCellContainer in project Eidolons by IDemiurge.
the class GlobalController method tab.
private void tab() {
GridUnitView hovered = DungeonScreen.getInstance().getGridPanel().getHoverObj();
GridCellContainer cell = (GridCellContainer) hovered.getParent();
List<GenericGridView> list = new ArrayList<>(cell.getUnitViewsVisible());
if (list.size() == 1)
// or do something else
return;
SortMaster.sortByExpression(list, view -> view.hashCode());
int index = list.indexOf(hovered);
index++;
if (list.size() <= index)
index = 0;
GuiEventManager.trigger(GuiEventType.GRID_OBJ_HOVER_OFF, hovered);
GenericGridView newFocus = list.get(index);
cell.popupUnitView(newFocus);
GuiEventManager.trigger(GuiEventType.GRID_OBJ_HOVER_ON, newFocus);
GuiEventManager.trigger(GuiEventType.SHOW_TOOLTIP, newFocus.getTooltip());
}
use of eidolons.libgdx.bf.grid.GridCellContainer in project Eidolons by IDemiurge.
the class ShadeLightCell method adjustPosition.
public void adjustPosition(int x, int y) {
float offsetX = 0;
float offsetY = 0;
setScale(1f, 1f);
setVisible(true);
for (Obj sub : DC_Game.game.getRules().getIlluminationRule().getEffectCache().keySet()) {
if (sub instanceof Unit)
// TODO illuminate some other way for units...
continue;
if (sub instanceof Structure) {
if (sub.getCoordinates().x == x)
if (sub.getCoordinates().y == y)
if (((Structure) sub).isOverlaying()) {
DIRECTION d = ((Structure) sub).getDirection();
if (d == null) {
setScale(0.7f, 0.7f);
continue;
}
setScale(d.growX == null ? 1 : 0.8f, d.growY == null ? 1 : 0.8f);
Dimension dim = GridMaster.getOffsetsForOverlaying(d, (int) getWidth() - 64, (int) getHeight() - 64);
offsetX += dim.width;
offsetY += dim.height;
// so if 2+ overlays, will be centered between them...
} else {
BaseView view = DungeonScreen.getInstance().getGridPanel().getViewMap().get(sub);
offsetX += view.getX() * 3;
offsetY += view.getY() * 3;
if (view.getParent() instanceof GridCellContainer) {
if ((((GridCellContainer) view.getParent()).getUnitViews(true).size() > 1)) {
if (!view.isHovered())
setVisible(false);
}
}
}
}
}
setPosition(originalX + offsetX / 3, originalY + offsetY / 3);
}
Aggregations