use of eidolons.libgdx.bf.overlays.OverlaysManager in project Eidolons by IDemiurge.
the class GridPanel method init.
public GridPanel init(DequeImpl<BattleFieldObject> units) {
this.viewMap = new HashMap<>();
emptyImage = TextureCache.getOrCreateR(getCellImagePath());
cornerRegion = TextureCache.getOrCreateR(gridCornerElementPath);
cells = new GridCellContainer[cols][rows];
int rows1 = rows - 1;
for (int x = 0; x < cols; x++) {
for (int y = 0; y < rows; y++) {
cells[x][y] = new GridCellContainer(emptyImage, x, rows1 - y);
cells[x][y].setX(x * GridMaster.CELL_W);
cells[x][y].setY(y * GridMaster.CELL_H);
addActor(cells[x][y].init());
checkAddBorder(x, y);
}
}
if (OptionsMaster.getGraphicsOptions().getBooleanValue(GRAPHIC_OPTION.SPRITE_CACHE_ON))
TextureManager.addCellsToCache(cols, rows);
addActor(new CellBorderManager());
bindEvents();
createUnitsViews(units);
setHeight(cells[0][0].getHeight() * rows);
setWidth(cells[0][0].getWidth() * cols);
addListener(new BattleClickListener() {
@Override
public boolean mouseMoved(InputEvent event, float x, float y) {
GridPanel.this.getStage().setScrollFocus(GridPanel.this);
return false;
}
@Override
public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
// return PhaseAnimator.getInstance().checkAnimClicked(x, y, pointer, button);
return false;
}
});
addActor(overlayManager = new OverlaysManager(this));
addActor(animMaster = AnimMaster.getInstance());
animMaster.bindEvents();
if (AnimationConstructor.isPreconstructAllOnGameInit())
units.forEach(unit -> {
if (unit instanceof Unit)
animMaster.getConstructor().preconstructAll((Unit) unit);
});
if (fpsDebug) {
fpsLabel = new Label("0", StyleHolder.getDefaultLabelStyle());
addActor(fpsLabel);
fpsLabel.setAlignment(Align.topLeft);
}
return this;
}
Aggregations