Search in sources :

Example 36 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class ResistPanel method addContainer.

void addContainer(Pair<TextureRegion, DAMAGE_TYPE> pair) {
    ValueContainer valueContainer = new ValueContainer(pair.getLeft(), "n/a");
    valueContainer.setSize(32, 32);
    map.put(pair.getRight(), valueContainer);
    addElement(valueContainer);
}
Also used : ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Example 37 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class ResistPanel method updateAct.

@Override
public void updateAct(float delta) {
    List<Pair<PARAMETER, String>> source = (List<Pair<PARAMETER, String>>) getUserObject();
    source.forEach(pair -> {
        PARAMS param = (PARAMS) pair.getLeft();
        DAMAGE_TYPE damageType = getFromParams(param);
        if (map.containsKey(damageType)) {
            final ValueContainer container = map.get(damageType);
            ValueTooltip valueTooltip = new ValueTooltip();
            valueTooltip.setUserObject((Supplier) () -> Arrays.asList(new ValueContainer(param.getName(), "")));
            container.addListener(valueTooltip.getController());
            container.updateValue(pair.getRight() + "%");
        }
    });
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) PARAMS(eidolons.content.PARAMS) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Pair(org.apache.commons.lang3.tuple.Pair) PARAMETER(main.content.values.parameters.PARAMETER)

Example 38 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class UnitDataSource method getArmorObj.

@Override
public ValueContainer getArmorObj() {
    final DC_ArmorObj armor = unit.getArmor();
    final ValueContainer container;
    if (armor != null) {
        container = new ValueContainer(getOrCreateR(armor.getImagePath()));
        WeaponTooltip tooltip = new WeaponTooltip();
        tooltip.setUserObject(new WeaponToolTipDataSource() {

            @Override
            public List<ValueContainer> getMainParams() {
                return Arrays.stream(ARMOR_TOOLTIP).map(el -> new ValueContainer(el.getName(), armor.getStrParam(el)).pad(10)).collect(Collectors.toList());
            }

            @Override
            public List<ValueContainer> getBuffs() {
                return armor.getBuffs().stream().filter(obj -> StringUtils.isNoneEmpty(obj.getType().getProperty(G_PROPS.IMAGE))).map(AttackTooltipFactory.getObjValueContainerMapper()).collect(Collectors.toList());
            }
        });
        container.addListener(tooltip.getController());
    } else {
        container = new ValueContainer(getOrCreateR(CELL_TYPE.ARMOR.getSlotImagePath()));
    }
    return container;
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) Arrays(java.util.Arrays) AttackTooltipFactory(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltipFactory) UiMaster(eidolons.libgdx.gui.UiMaster) PARAMS(eidolons.content.PARAMS) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) WeaponToolTipDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource) TextureCache.getOrCreateR(eidolons.libgdx.texture.TextureCache.getOrCreateR) Pair(org.apache.commons.lang3.tuple.Pair) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Tooltip(eidolons.libgdx.gui.tooltips.Tooltip) G_PROPS(main.content.values.properties.G_PROPS) DC_UnitAction(eidolons.entity.active.DC_UnitAction) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) CELL_TYPE(eidolons.libgdx.gui.panels.dc.inventory.InventoryClickHandler.CELL_TYPE) AttackTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltip) Collectors(java.util.stream.Collectors) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) PARAMETER(main.content.values.parameters.PARAMETER) ImageManager(main.system.images.ImageManager) List(java.util.List) TextureCache(eidolons.libgdx.texture.TextureCache) ValuePages(eidolons.content.ValuePages) ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) Unit(eidolons.entity.obj.unit.Unit) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj) ArrayList(java.util.ArrayList) List(java.util.List) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) WeaponToolTipDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource)

Aggregations

ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)38 ValueTooltip (eidolons.libgdx.gui.tooltips.ValueTooltip)12 ArrayList (java.util.ArrayList)12 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)10 VerticalValueContainer (eidolons.libgdx.gui.generic.VerticalValueContainer)8 List (java.util.List)8 PARAMS (eidolons.content.PARAMS)7 DC_UnitAction (eidolons.entity.active.DC_UnitAction)5 TextureCache (eidolons.libgdx.texture.TextureCache)5 Arrays (java.util.Arrays)5 PARAMETER (main.content.values.parameters.PARAMETER)5 G_PROPS (main.content.values.properties.G_PROPS)5 Pair (org.apache.commons.lang3.tuple.Pair)5 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)4 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)4 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)4 Unit (eidolons.entity.obj.unit.Unit)4 TablePanel (eidolons.libgdx.gui.panels.TablePanel)4 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)4 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)3