Search in sources :

Example 1 with CellComp

use of eidolons.swing.components.obj.CellComp in project Eidolons by IDemiurge.

the class DC_BattleFieldGrid method resetComponents.

@Deprecated
private void resetComponents() {
    int offsetX = getOffsetX();
    int offsetY = getOffsetY();
    LogMaster.log(0, "resetting grid comps with offsetX = " + offsetX + ";offsetY =" + offsetY);
    for (int i = 0; i < getDisplayedCellsX(); i++) {
        for (int j = 0; j < getDisplayedCellsY(); j++) {
            int x = i + getOffsetX();
            int y = j + getOffsetY();
            Coordinates c = new Coordinates(x, y);
            List<BattleFieldObject> objects = game.getObjectsOnCoordinate(getZ(), c, false, true, false);
            List<Unit> overlayingObjects = new ArrayList<>(new DequeImpl(game.getObjectsOnCoordinate(getZ(), c, true, true, false)).getRemoveAll(objects));
            // visibility preCheck!
            CellComp comp = gridComp.getCells()[x][y];
            List<BattleFieldObject> list = new ArrayList<>();
            for (BattleFieldObject obj : objects) {
                if (VisionManager.checkVisible(obj)) {
                    list.add(obj);
                }
            }
            comp.setSizeFactor(gridComp.getZoom());
            comp.setOverlayingObjects(overlayingObjects);
            if (list.size() != 0) {
            // comp.setObjects(list);
            }
            comp.refresh();
        }
    }
    comp.refresh();
}
Also used : CellComp(eidolons.swing.components.obj.CellComp) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit) DequeImpl(main.system.datatypes.DequeImpl)

Example 2 with CellComp

use of eidolons.swing.components.obj.CellComp in project Eidolons by IDemiurge.

the class AnimationManager method setOverlayingImage.

private void setOverlayingImage(Obj obj, Image img) {
    CellComp objComponent = getComp(obj);
    objComponent.setCenterOverlayingImage(img);
}
Also used : CellComp(eidolons.swing.components.obj.CellComp)

Example 3 with CellComp

use of eidolons.swing.components.obj.CellComp in project Eidolons by IDemiurge.

the class LE_MouseMaster method mouseClicked.

public void mouseClicked(MouseEvent e) {
    // info click!
    DC_Obj obj;
    coordinates = null;
    boolean right = SwingUtilities.isRightMouseButton(e);
    CellComp cellComp = getGrid().getCompByPoint(e.getPoint());
    previousCoordinate = coordinates;
    coordinates = cellComp.getCoordinates();
    obj = cellComp.getTopObjOrCell();
    obj.setCoordinates(coordinates);
    lastClicked = obj;
    if (!right) {
        selectedObj = obj;
    }
    if (right) {
        setMode(null);
    }
    if (checkEventConsumed(obj, right)) {
        getGrid().getPanel().repaint();
        return;
    }
    LevelEditor.getGrid().setDirty(true);
    handleClick(e, right);
    if (LevelEditor.getGrid().isDirty()) {
        LevelEditor.getGrid().refresh();
    }
}
Also used : CellComp(eidolons.swing.components.obj.CellComp) DC_Obj(eidolons.entity.obj.DC_Obj)

Example 4 with CellComp

use of eidolons.swing.components.obj.CellComp in project Eidolons by IDemiurge.

the class LE_Simulation method getCells.

@Override
public Set<Obj> getCells() {
    if (cells != null) {
        return cells;
    }
    cells = new HashSet<>();
    for (int i = 0; i < LevelEditor.getGrid().getCellsX(); i++) {
        for (int j = 0; j < LevelEditor.getGrid().getCellsY(); j++) {
            CellComp c = LevelEditor.getGrid().getCells()[i][j];
            cells.add(c.getTerrainObj());
        }
    }
    return cells;
}
Also used : CellComp(eidolons.swing.components.obj.CellComp)

Example 5 with CellComp

use of eidolons.swing.components.obj.CellComp in project Eidolons by IDemiurge.

the class AnimationManager method addTextOverlay.

private void addTextOverlay(String amount, Ref ref, int delay, Color c, Point p) {
    CellComp comp = getComp(ref.getTargetObj());
    SmartText text = new SmartText(amount, c);
    text.setFont(FontMaster.getFont(FONT.AVQ, DEFAULT_OVERLAY_FONT_SIZE, Font.PLAIN));
    comp.addAnimOverlayingString(p, text);
    animate(delay, comp);
}
Also used : CellComp(eidolons.swing.components.obj.CellComp) SmartText(main.system.text.SmartText)

Aggregations

CellComp (eidolons.swing.components.obj.CellComp)6 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Unit (eidolons.entity.obj.unit.Unit)1 Coordinates (main.game.bf.Coordinates)1 DequeImpl (main.system.datatypes.DequeImpl)1 SmartText (main.system.text.SmartText)1