Search in sources :

Example 1 with WeaponToolTipDataSource

use of eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource in project Eidolons by IDemiurge.

the class UnitDataSource method getWeaponValueContainer.

private ValueContainer getWeaponValueContainer(DC_WeaponObj weapon) {
    TextureRegion image;
    if (weapon != null) {
        image = getOrCreateR(weapon.getImagePath());
    } else {
        image = getOrCreateR(CELL_TYPE.WEAPON_MAIN.getSlotImagePath());
    }
    ValueContainer valueContainer = new ValueContainer(image);
    if (weapon != null) {
        List<ValueContainer> list = new ArrayList<>();
        for (int i = 0; i < WEAPON_DC_INFO_PARAMS.length; i++) {
            PARAMS p = WEAPON_DC_INFO_PARAMS[i];
            String value = String.valueOf(weapon.getIntParam(p));
            String name = p.getName();
            final ValueContainer tooltipContainer = new ValueContainer(name, value);
            tooltipContainer.pad(10);
            list.add(tooltipContainer);
        }
        Tooltip tooltip = new WeaponTooltip();
        tooltip.setUserObject(new WeaponToolTipDataSource() {

            @Override
            public List<ValueContainer> getMainParams() {
                return list;
            }

            @Override
            public List<ValueContainer> getBuffs() {
                return weapon.getBuffs().stream().filter(obj -> StringUtils.isNoneEmpty(obj.getType().getProperty(G_PROPS.IMAGE))).map(AttackTooltipFactory.getObjValueContainerMapper()).collect(Collectors.toList());
            }
        });
        valueContainer.addListener(tooltip.getController());
    }
    return valueContainer;
}
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) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) Tooltip(eidolons.libgdx.gui.tooltips.Tooltip) AttackTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltip) ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) ArrayList(java.util.ArrayList) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ArrayList(java.util.ArrayList) List(java.util.List) VerticalValueContainer(eidolons.libgdx.gui.generic.VerticalValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) UNIT_INFO_PARAMS(eidolons.content.UNIT_INFO_PARAMS) PARAMS(eidolons.content.PARAMS) WeaponTooltip(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip) WeaponToolTipDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource)

Example 2 with WeaponToolTipDataSource

use of eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource 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

TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 PARAMS (eidolons.content.PARAMS)2 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)2 ValuePages (eidolons.content.ValuePages)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 Unit (eidolons.entity.obj.unit.Unit)2 UiMaster (eidolons.libgdx.gui.UiMaster)2 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)2 VerticalValueContainer (eidolons.libgdx.gui.generic.VerticalValueContainer)2 CELL_TYPE (eidolons.libgdx.gui.panels.dc.inventory.InventoryClickHandler.CELL_TYPE)2 AttackTooltip (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltip)2 AttackTooltipFactory (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.AttackTooltipFactory)2 WeaponToolTipDataSource (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponToolTipDataSource)2 WeaponTooltip (eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip)2 Tooltip (eidolons.libgdx.gui.tooltips.Tooltip)2 ValueTooltip (eidolons.libgdx.gui.tooltips.ValueTooltip)2 TextureCache (eidolons.libgdx.texture.TextureCache)2 TextureCache.getOrCreateR (eidolons.libgdx.texture.TextureCache.getOrCreateR)2