use of eidolons.libgdx.gui.panels.TablePanel in project Eidolons by IDemiurge.
the class PartyInfoPanel method init.
public void init(MacroParty party) {
clearChildren();
clearListeners();
this.party = party;
TablePanel main = new TablePanel();
this.columnDefaults(0).width(getMainWidth());
this.columnDefaults(0).minWidth(getMainWidth());
for (Unit sub : party.getMembers()) {
PartyMemberComponent component = new PartyMemberComponent(sub);
main.add(component).maxWidth(getMainWidth());
main.row();
}
setSize((getMainWidth()), 128 * party.getMembers().size());
// ;
add(main);
setX(0);
}
use of eidolons.libgdx.gui.panels.TablePanel in project Eidolons by IDemiurge.
the class PlaceTooltip method updateAct.
@Override
public void updateAct(float delta) {
clearChildren();
TextureRegion r = TextureCache.getOrCreateR(place.getImagePath());
ValueContainer container = new ValueContainer(r, place.getName());
float size = GdxMaster.adjustSize(128);
if (size < r.getRegionHeight() && size < r.getRegionWidth())
container.overrideImageSize(size, size);
add(container);
setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
// return ;
if (place.getRoutes().isEmpty()) {
return;
}
row();
TablePanel<ValueContainer> routesInfo = new TablePanel<>();
routesInfo.defaults().space(5);
add(routesInfo);
routesInfo.addListener(new ClickListener() {
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
if (toActor == routesInfo)
return;
if (toActor == null) {
if (getWidth() >= x)
return;
if (getWidth() >= y)
return;
}
if (GdxMaster.getAncestors(toActor).contains(routesInfo))
return;
if (!checkActorExitRemoves(toActor))
return;
super.exit(event, x, y, pointer, toActor);
GuiEventManager.trigger(MapEvent.ROUTES_PANEL_HOVER_OFF);
}
});
int i = 0;
for (Route sub : place.getRoutes()) {
// reverse pic pos
TextureRegion tex = TextureCache.getOrCreateR(sub.getImagePath());
ValueContainer routeInfo = new ValueContainer(tex, sub.getName(), sub.getLength() + " leagues");
routeInfo.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
routesInfo.add(routeInfo).left().padLeft(5).uniform(true, false);
routeInfo.setUserObject(sub);
routeInfo.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
// getTapCount()
GuiEventManager.trigger(MapEvent.ROUTE_HOVERED, sub);
return super.touchDown(event, x, y, pointer, button);
}
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor);
GuiEventManager.trigger(MapEvent.ROUTE_HOVERED, null);
}
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
super.enter(event, x, y, pointer, fromActor);
GuiEventManager.trigger(MapEvent.ROUTE_HOVERED, sub);
}
});
if (i % 2 == 1)
routesInfo.row();
i++;
}
}
use of eidolons.libgdx.gui.panels.TablePanel in project Eidolons by IDemiurge.
the class BaseSlotPanel method setActivePage.
protected void setActivePage(PagesMod page) {
TablePanel view = modTableMap.get(activePage);
if (view == null) {
return;
}
view.setVisible(false);
activePage = page;
modTableMap.get(activePage).setVisible(true);
}
use of eidolons.libgdx.gui.panels.TablePanel in project Eidolons by IDemiurge.
the class BaseSlotPanel method addPage.
protected void addPage(List<ActionValueContainer> list, String emptyImagePath) {
final TablePanel page = initPage(list, emptyImagePath);
modTableMap.put(PagesMod.values()[modTableMap.size()], page);
addElement(page).left().bottom();
page.setVisible(false);
}
use of eidolons.libgdx.gui.panels.TablePanel in project Eidolons by IDemiurge.
the class WeaponTooltip method initTableValues.
private TablePanel initTableValues(List<ValueContainer> valueContainers) {
TablePanel table = new TablePanel();
final int size = valueContainers.size();
int halfSize = size / 2;
if (size % 2 != 0) {
halfSize++;
}
for (int i = 0; i < halfSize; i++) {
ValueContainer valueContainer = valueContainers.get(i);
valueContainer.cropName();
valueContainer.setNameAlignment(Align.left);
valueContainer.setBorder(getOrCreateR("UI/components/infopanel/simple_value_border.png"));
table.addElement(valueContainer);
final int i1 = i + halfSize;
if (i1 < valueContainers.size()) {
valueContainer = valueContainers.get(i1);
valueContainer.cropName();
valueContainer.setNameAlignment(Align.left);
valueContainer.setBorder(getOrCreateR("UI/components/infopanel/simple_value_border.png"));
table.addElement(valueContainer);
}
table.row();
}
return table;
}
Aggregations