Search in sources :

Example 1 with TablePanel

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);
}
Also used : Unit(eidolons.entity.obj.unit.Unit) TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 2 with TablePanel

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++;
    }
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) PlaceActor(eidolons.libgdx.screens.map.obj.PlaceActor) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) Route(eidolons.game.module.adventure.map.Route) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable) TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 3 with TablePanel

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);
}
Also used : TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 4 with TablePanel

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);
}
Also used : TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 5 with TablePanel

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;
}
Also used : ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Aggregations

TablePanel (eidolons.libgdx.gui.panels.TablePanel)14 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)4 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)3 Actor (com.badlogic.gdx.scenes.scene2d.Actor)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 Action (com.badlogic.gdx.scenes.scene2d.Action)1 Group (com.badlogic.gdx.scenes.scene2d.Group)1 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)1 DelayAction (com.badlogic.gdx.scenes.scene2d.actions.DelayAction)1 Container (com.badlogic.gdx.scenes.scene2d.ui.Container)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)1 Unit (eidolons.entity.obj.unit.Unit)1 Route (eidolons.game.module.adventure.map.Route)1 InventorySlotsPanel (eidolons.libgdx.gui.panels.dc.inventory.InventorySlotsPanel)1 InventoryDataSource (eidolons.libgdx.gui.panels.dc.inventory.datasource.InventoryDataSource)1