use of eidolons.libgdx.bf.grid.BaseView in project Eidolons by IDemiurge.
the class DoorAnimation method start.
@Override
public void start() {
setDuration(1);
Obj door = getRef().getTargetObj();
BaseView actor = DungeonScreen.getInstance().getGridPanel().getViewMap().get(door);
// ActorMaster.addFadeInOrOut(actor.getPortrait(), getDuration());
if (open) {
String path = door.getImagePath();
path = StringMaster.cropFormat(path) + "_open" + ".png";
// if (newImage == null)
{
// TODO as an afterAction!
TextureRegion r = TextureCache.getOrCreateR(path);
actor.setOriginalTextureAlt(r);
// newImage = new Image(r);
}
} else {
actor.setOriginalTextureAlt(null);
// newImage = actor.getAltPortrait();
}
// newImage.setColor(1, 1, 1, 0);
// actor.setAltPortrait(actor.getPortrait());
// actor.setPortrait(newImage);
// actor.addActor(newImage);
// ActorMaster.addFadeInOrOut(actor.getPortrait(), getDuration());
super.start();
}
use of eidolons.libgdx.bf.grid.BaseView in project Eidolons by IDemiurge.
the class FloatingTextMaster method createAndShowParamModText.
public void createAndShowParamModText(Object o) {
Pair<PARAMETER, Ref> pair = (Pair<PARAMETER, Ref>) o;
Entity active = pair.getValue().getObj(KEYS.ACTIVE);
int amount = 0;
if (pair.getValue().getAmount() != null)
amount = pair.getValue().getAmount();
else {
return;
}
FloatingText text = getFloatingText(active, TEXT_CASES.PARAM_MOD, new ImmutablePair<>(pair.getKey(), amount));
Obj obj = active.getRef().getTargetObj();
if (obj == null)
obj = active.getRef().getSourceObj();
if (obj != null) {
BaseView view = DungeonScreen.getInstance().getGridPanel().getViewMap().get(obj);
if (view != null) {
Vector2 v = view.localToStageCoordinates(new Vector2(view.getX(), view.getY()));
text.setPosition(v.x, v.y);
}
}
GuiEventManager.trigger(GuiEventType.ADD_FLOATING_TEXT, text);
}
use of eidolons.libgdx.bf.grid.BaseView in project Eidolons by IDemiurge.
the class MoveAnimation method start.
@Override
public void start() {
try {
super.start();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
Unit unit = (Unit) getRef().getSourceObj();
if (!ListMaster.isNotEmpty(EffectFinder.getEffectsOfClass(getActive(), MoveEffect.class)))
unit = (Unit) getRef().getTargetObj();
BaseView actor = DungeonScreen.getInstance().getGridPanel().getViewMap().get(unit);
if (!DungeonScreen.getInstance().getGridPanel().detachUnitView(unit)) {
return;
}
// DungeonScreen.getInstance().getGridStage().addActor(actor);
// actor.setPosition(getX(), getY());
getAction().setStartPointY(actor.getY());
getAction().setStartPointX(actor.getX());
actor.addAction(getAction());
action.setTarget(actor);
}
use of eidolons.libgdx.bf.grid.BaseView in project Eidolons by IDemiurge.
the class GdxUnitPosSizeTest method test.
@Test
public void test() {
WaitMaster.waitForInput(WAIT_OPERATIONS.DUNGEON_SCREEN_READY);
player = DC_Game.game.getPlayer(true);
for (Unit unit : DC_Game.game.getUnits()) {
BaseView component = DungeonScreen.getInstance().getGridPanel().getViewMap().get(unit);
container = (GridCellContainer) component.getParent();
container.recalcUnitViewBounds();
int index = 0;
for (BaseView sub : container.getUnitViews(true)) {
checkComponent(sub, container.getUnitViews(true).size(), // + 2
index);
index++;
}
}
}
use of eidolons.libgdx.bf.grid.BaseView 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