use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class FormationMaster method formationArrives.
public void formationArrives(FORMATION formation, Party party) {
Coordinates origin = getDefaultPoint(getMaster().getDungeonMaster().getDungeon(), formation);
FACING_DIRECTION facing;
// calculateOrganizationValue
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class GridPanel method bindEvents.
private void bindEvents() {
GuiEventManager.bind(GuiEventType.ANIMATION_QUEUE_FINISHED, (p) -> {
resetVisible();
});
GuiEventManager.bind(GuiEventType.UPDATE_LAST_SEEN_VIEWS, p -> {
List<BattleFieldObject> list = (List<BattleFieldObject>) p.get();
for (BattleFieldObject sub : viewMap.keySet()) {
GridUnitView view = (GridUnitView) viewMap.get(sub);
if (list.contains(sub)) {
setVisible(view.getLastSeenView(), true);
} else {
setVisible(view.getLastSeenView(), false);
}
}
});
GuiEventManager.bind(UNIT_GREYED_OUT_ON, obj -> {
BattleFieldObject bfObj = (BattleFieldObject) obj.get();
if (bfObj.isOverlaying())
return;
UnitView unitView = getUnitView(bfObj);
unitView.setFlickering(true);
unitView.setGreyedOut(true);
// unitView.setVisible(true);
});
GuiEventManager.bind(UNIT_GREYED_OUT_OFF, obj -> {
BattleFieldObject bfObj = (BattleFieldObject) obj.get();
if (bfObj.isOverlaying())
return;
UnitView unitView = getUnitView(bfObj);
unitView.setGreyedOut(false);
unitView.setFlickering(false);
// ActorMaster.getActionsOfClass(unitView, AlphaAction.class);
unitView.getActions().clear();
// unitView.setVisible(true);
});
GuiEventManager.bind(UNIT_STARTS_MOVING, obj -> {
detachUnitView((BattleFieldObject) obj.get());
});
// GuiEventManager.bind(GRID_OBJ_HOVER_ON, (event) -> {
// resetZIndices();
// });
// GuiEventManager.bind(GRID_OBJ_HOVER_OFF, (event) -> {
// resetZIndices();
// });
GuiEventManager.bind(UNIT_MOVED, obj -> {
moveUnitView((BattleFieldObject) obj.get());
});
GuiEventManager.bind(UPDATE_GUI, obj -> {
if (!VisionManager.isVisionHacked())
if (OutlineMaster.isAutoOutlinesOff())
if (OutlineMaster.isOutlinesOn()) {
updateOutlines();
}
firstUpdateDone = true;
resetVisibleRequired = true;
updateRequired = true;
DungeonScreen.getInstance().updateGui();
});
GuiEventManager.bind(SELECT_MULTI_OBJECTS, obj -> {
Pair<Set<DC_Obj>, TargetRunnable> p = (Pair<Set<DC_Obj>, TargetRunnable>) obj.get();
if (p.getLeft().isEmpty()) {
FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.REQUIREMENT, "No targets available!", Eidolons.getGame().getManager().getControlledObj());
return;
}
Map<Borderable, Runnable> map = new HashMap<>();
for (DC_Obj obj1 : p.getLeft()) {
Borderable b = viewMap.get(obj1);
if (b == null) {
b = cells[obj1.getX()][rows - 1 - obj1.getY()];
}
if (b instanceof GridUnitView) {
final GridUnitView gridView = (GridUnitView) b;
final UnitView unitView = gridView.getInitiativeQueueUnitView();
map.put(unitView, () -> p.getRight().run(obj1));
}
map.put(b, () -> p.getRight().run(obj1));
}
GuiEventManager.trigger(SHOW_BLUE_BORDERS, map);
});
GuiEventManager.bind(DESTROY_UNIT_MODEL, param -> {
BattleFieldObject unit = (BattleFieldObject) param.get();
removeUnitView(unit);
});
GuiEventManager.bind(INGAME_EVENT_TRIGGERED, onIngameEvent());
GuiEventManager.bind(UPDATE_GRAVEYARD, obj -> {
final Coordinates coordinates = (Coordinates) obj.get();
cells[coordinates.getX()][rows - 1 - coordinates.getY()].updateGraveyard();
});
GuiEventManager.bind(ACTIVE_UNIT_SELECTED, obj -> {
BattleFieldObject hero = (BattleFieldObject) obj.get();
DungeonScreen.getInstance().activeUnitSelected(hero);
if (hero instanceof Unit)
animMaster.getConstructor().tryPreconstruct((Unit) hero);
BaseView view = viewMap.get(hero);
if (view == null) {
System.out.println("viewMap not initiatilized at ACTIVE_UNIT_SELECTED!");
return;
}
if (view.getParent() instanceof GridCellContainer) {
((GridCellContainer) view.getParent()).popupUnitView((GridUnitView) view);
}
viewMap.values().stream().forEach(v -> v.setActive(false));
view.setActive(true);
if (hero.isMine()) {
GuiEventManager.trigger(SHOW_TEAM_COLOR_BORDER, view);
GuiEventManager.trigger(BOTTOM_PANEL_UPDATE, new PanelActionsDataSource((Unit) hero));
} else {
GuiEventManager.trigger(SHOW_TEAM_COLOR_BORDER, view);
GuiEventManager.trigger(BOTTOM_PANEL_UPDATE, null);
}
if (!firstUpdateDone) {
DC_Game.game.getVisionMaster().triggerGuiEvents();
GuiEventManager.trigger(UPDATE_GUI, null);
GuiEventManager.trigger(UPDATE_LIGHT);
}
if (HelpMaster.isDefaultTextOn())
if (!welcomeInfoShown) {
new Thread(() -> {
WaitMaster.WAIT(2000);
GuiEventManager.trigger(SHOW_TEXT_CENTERED, HelpMaster.getWelcomeText());
}, " thread").start();
welcomeInfoShown = true;
}
});
// GuiEventManager.bind(UPDATE_UNIT_VISIBLE, obj -> {
// final Pair<Unit, Boolean> pair = (Pair<Unit, Boolean>) obj.get();
// final BaseView baseView = viewMap.get(pair.getLeft());
// if (baseView instanceof GridUnitView) {
// final Boolean isVisible = pair.getRight();
// //TODO ???
// ((GridUnitView) baseView).setVisibleVal(isVisible ? 100 : 50);
// }
// });
GuiEventManager.bind(UNIT_VISIBLE_ON, p -> {
if (p.get() instanceof Collection) {
for (Object sub : ((Collection) p.get())) {
setVisible((BattleFieldObject) sub, true);
}
return;
}
setVisible((BattleFieldObject) p.get(), true);
});
GuiEventManager.bind(UNIT_VISIBLE_OFF, p -> {
if (p.get() instanceof Collection) {
for (Object sub : ((Collection) p.get())) {
setVisible((BattleFieldObject) sub, false);
}
return;
}
setVisible((BattleFieldObject) p.get(), false);
});
GuiEventManager.bind(UPDATE_UNIT_ACT_STATE, obj -> {
final Pair<Unit, Boolean> pair = (Pair<Unit, Boolean>) obj.get();
final BaseView baseView = viewMap.get(pair.getLeft());
if (baseView instanceof GridUnitView) {
final boolean mobilityState = pair.getRight();
((GridUnitView) baseView).getInitiativeQueueUnitView().setQueueMoving(mobilityState);
}
});
GuiEventManager.bind(GuiEventType.HP_BAR_UPDATE_MANY, p -> {
List list = (List) p.get();
list.forEach(o -> updateHpBar(o));
});
GuiEventManager.bind(GuiEventType.HP_BAR_UPDATE, p -> {
updateHpBar(p.get());
});
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class GridPanel method moveUnitView.
private void moveUnitView(BattleFieldObject object) {
int rows1 = rows - 1;
GridUnitView uv = (GridUnitView) viewMap.get(object);
if (uv == null) {
return;
}
Coordinates c = object.getCoordinates();
try {
cells[c.x][rows1 - c.y].addActor(uv);
if (uv.getLastSeenView() != null) {
if (LastSeenMaster.isUpdateRequired(object))
cells[c.x][rows1 - c.y].addActor(uv.getLastSeenView());
}
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
setUpdateRequired(true);
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class WallMap method drawDiagonalJoints.
private void drawDiagonalJoints(Batch batch, Set<Coordinates> set) {
if (diagonalJoints == null)
return;
for (Coordinates c : set) {
List<Coordinates.DIRECTION> list = diagonalJoints.get(c);
if (!ListMaster.isNotEmpty(list))
continue;
if (checkCoordinateIgnored(c))
continue;
int h = GridMaster.CELL_H;
int w = GridMaster.CELL_W;
for (Coordinates.DIRECTION side : list) {
Vector2 v = GridMaster.getVectorForCoordinate(c, false, false);
float x1 = v.x;
float y1 = v.y;
boolean flipped = false;
if (side == Coordinates.DIRECTION.DOWN_LEFT) {
y1 -= h;
} else if (side == Coordinates.DIRECTION.DOWN_RIGHT) {
x1 += w;
y1 -= h;
flipped = true;
} else if (side == Coordinates.DIRECTION.UP_LEFT) {
flipped = true;
} else if (side == Coordinates.DIRECTION.UP_RIGHT) {
x1 += w;
}
String suffix = flipped ? " flipped" : null;
TextureRegion image = getRegion(STD_IMAGES.WALL_CORNER_ALMOND, suffix);
// if (flipped) {
// // TODO image = ImageTransformer.flipHorizontally(ImageManager.getBufferedImage(image));
// }
batch.draw(image, x1 - image.getRegionWidth() / 2, y1 - image.getRegionHeight() / 2);
}
}
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class GridCell method act.
@Override
public void act(float delta) {
if (gridX == 0)
if (gridY == 0)
gridX = 0;
if (!SuperActor.isCullingOff())
if (!DungeonScreen.getInstance().controller.isWithinCamera((this))) {
return;
}
super.act(delta);
if (DC_Game.game.isDebugMode()) {
if (!cordsText.isVisible()) {
cordsText.setVisible(true);
}
if (GammaMaster.DEBUG_MODE) {
DC_Cell cell = DC_Game.game.getCellByCoordinate(new Coordinates(gridX, gridY));
cordsText.setText(getGridX() + ":" + getGridY() + "\n gamma=" + DC_Game.game.getVisionMaster().getGammaMaster().getGammaForCell(getGridX(), getGridY()) + "\n illumination=" + cell.getIntParam(PARAMS.ILLUMINATION));
cordsText.setPosition(0, getHeight() / 2 - cordsText.getHeight() / 2);
} else {
cordsText = new Label(getGridX() + ":" + getGridY(), StyleHolder.getDefaultLabelStyle());
cordsText.setPosition(getWidth() / 2 - cordsText.getWidth() / 2, getHeight() / 2 - cordsText.getHeight() / 2);
}
} else {
if (cordsText.isVisible()) {
cordsText.setVisible(false);
}
}
}
Aggregations