use of eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip 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;
}
use of eidolons.libgdx.gui.panels.dc.unitinfo.tooltips.WeaponTooltip 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;
}
Aggregations