use of eidolons.libgdx.bf.light.ShadowMap in project Eidolons by IDemiurge.
the class GridPanel method createUnitsViews.
private void createUnitsViews(DequeImpl<BattleFieldObject> units) {
// lightingManager = new LightingManager(units, rows, cols);
Map<Coordinates, List<BattleFieldObject>> map = new HashMap<>();
for (BattleFieldObject object : units) {
Coordinates c = object.getCoordinates();
if (c == null)
continue;
if (!map.containsKey(c)) {
map.put(c, new ArrayList<>());
}
List<BattleFieldObject> list = map.get(c);
list.add(object);
}
for (Coordinates coordinates : map.keySet()) {
List<BaseView> views = new ArrayList<>();
List<OverlayView> overlays = new ArrayList<>();
if (map.get(coordinates) == null) {
continue;
}
for (BattleFieldObject object : map.get(coordinates)) {
if (!object.isOverlaying()) {
final BaseView baseView = createUnitView(object);
views.add(baseView);
} else {
final OverlayView overlay = UnitViewFactory.createOverlay(object);
if (!isVisibleByDefault(object))
overlay.setVisible(false);
viewMap.put(object, overlay);
Vector2 v = GridMaster.getVectorForCoordinate(object.getCoordinates(), false, false, this);
overlay.setPosition(v.x, v.y - GridMaster.CELL_H);
addOverlay(overlay);
}
}
final GridCellContainer gridCellContainer = cells[coordinates.getX()][rows - 1 - coordinates.getY()];
views.forEach(gridCellContainer::addActor);
}
shadowMap = new ShadowMap(this);
wallMap = new WallMap();
addActor(wallMap);
GuiEventManager.bind(SHOW_MODE_ICON, obj -> {
List list = (List) obj.get();
UnitView view = (UnitView) getViewMap().get(list.get(0));
view.updateModeImage((String) list.get(1));
});
if (DC_Engine.isAtbMode()) {
GuiEventManager.bind(INITIATIVE_CHANGED, obj -> {
Pair<Unit, Pair<Integer, Float>> p = (Pair<Unit, Pair<Integer, Float>>) obj.get();
GridUnitView uv = (GridUnitView) viewMap.get(p.getLeft());
if (uv == null) {
addUnitView(p.getLeft());
uv = (GridUnitView) viewMap.get(p.getLeft());
}
if (uv != null) {
uv.getInitiativeQueueUnitView().setTimeTillTurn(p.getRight().getRight());
uv.getInitiativeQueueUnitView().updateInitiative(p.getRight().getLeft());
}
});
} else
GuiEventManager.bind(INITIATIVE_CHANGED, obj -> {
Pair<Unit, Integer> p = (Pair<Unit, Integer>) obj.get();
GridUnitView uv = (GridUnitView) viewMap.get(p.getLeft());
if (uv == null) {
addUnitView(p.getLeft());
uv = (GridUnitView) viewMap.get(p.getLeft());
}
if (uv != null)
uv.getInitiativeQueueUnitView().updateInitiative(p.getRight());
});
GuiEventManager.bind(UNIT_CREATED, p -> {
addUnitView((BattleFieldObject) p.get());
});
GuiEventManager.bind(VALUE_MOD, p -> {
FloatingTextMaster.getInstance().createAndShowParamModText(p.get());
});
WaitMaster.receiveInput(WAIT_OPERATIONS.GUI_READY, true);
WaitMaster.markAsComplete(WAIT_OPERATIONS.GUI_READY);
}
Aggregations