Search in sources :

Example 1 with ActionCostTooltip

use of eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip in project Eidolons by IDemiurge.

the class RadialManager method addCostTooltip.

public static void addCostTooltip(DC_ActiveObj el, ValueContainer valueContainer) {
    ActionCostTooltip tooltip = new ActionCostTooltip(el);
    tooltip.setRadial(true);
    tooltip.setUserObject(new ActionCostSourceImpl(el));
    valueContainer.addListener(tooltip.getController());
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) ActionCostSourceImpl(eidolons.libgdx.gui.panels.dc.actionpanel.datasource.ActionCostSourceImpl)

Example 2 with ActionCostTooltip

use of eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip in project Eidolons by IDemiurge.

the class PanelActionsDataSource method getQuickSlotActions.

@Override
public List<ActionValueContainer> getQuickSlotActions() {
    final DequeImpl<DC_QuickItemObj> items = unit.getQuickItems();
    if (items == null)
        return (List<ActionValueContainer>) ListMaster.fillWithNullElements(new ArrayList<ActionValueContainer>(), unit.getRemainingQuickSlots());
    List<ActionValueContainer> list = items.stream().map((DC_QuickItemObj key) -> {
        boolean valid = key.getActive().canBeManuallyActivated();
        final ActionValueContainer valueContainer = new ActionValueContainer(valid, getOrCreateR(key.getImagePath()), key::invokeClicked);
        ActionCostTooltip tooltip = new ActionCostTooltip(key.getActive());
        tooltip.setUserObject(new ActionCostSourceImpl(key.getActive()));
        valueContainer.addListener(tooltip.getController());
        return valueContainer;
    }).collect(Collectors.toList());
    ObjType type = DataManager.getType(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()), DC_TYPE.ACTIONS);
    TextureRegion invTexture = TextureCache.getOrCreateR(type.getImagePath());
    DC_UnitAction action = unit.getAction(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Use_Inventory.name()));
    if (action == null)
        return list;
    boolean valid = action.canBeManuallyActivated();
    ActionValueContainer invButton = new ActionValueContainer(valid, invTexture, () -> {
        action.clicked();
    });
    list.add(invButton);
    for (int i = 0; i < unit.getRemainingQuickSlots() - 1; i++) {
        list.add(null);
    }
    return list;
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ActionValueContainer(eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer) ObjType(main.entity.type.ObjType) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_UnitAction(eidolons.entity.active.DC_UnitAction)

Example 3 with ActionCostTooltip

use of eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip in project Eidolons by IDemiurge.

the class PanelActionsDataSource method getActionValueContainer.

public static ActionValueContainer getActionValueContainer(DC_ActiveObj el, boolean spell) {
    boolean valid = el.canBeManuallyActivated();
    final ActionValueContainer container = new ActionValueContainer(valid, TextureCache.getOrCreateSizedRegion(UiMaster.getIconSize(), getImage(el)), el::invokeClicked);
    ActionCostTooltip tooltip = new ActionCostTooltip(el);
    tooltip.setUserObject(new ActionCostSourceImpl(el));
    tooltip.addTo(container);
    return container;
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) ActionValueContainer(eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer)

Example 4 with ActionCostTooltip

use of eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip in project Eidolons by IDemiurge.

the class SpellRadialManager method createNodeBranch.

private static RadialValueContainer createNodeBranch(RADIAL_ITEM object, Unit source, DC_Obj target) {
    RadialValueContainer valueContainer;
    if (object instanceof EntityNode) {
        final DC_ActiveObj action = (DC_ActiveObj) object.getContents();
        valueContainer = RadialManager.configureActionNode(target, action);
        ActionCostTooltip tooltip = new ActionCostTooltip(action);
        tooltip.setRadial(true);
        tooltip.setUserObject(new ActionCostSourceImpl(action));
        valueContainer.addListener(tooltip.getController());
    } else {
        valueContainer = new SpellRadialContainer(TextureCache.getOrCreateSizedRegion(UiMaster.getIconSize(), object.getTexturePath()), null);
        valueContainer.setChildNodes(object.getItems(source).stream().map(el -> createNodeBranch(el, source, target)).collect(Collectors.toList()));
        String tooltip = StringMaster.getWellFormattedString(object.getContents().toString());
        addSimpleTooltip(valueContainer, tooltip);
    }
    return valueContainer;
}
Also used : ActionCostTooltip(eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActionCostSourceImpl(eidolons.libgdx.gui.panels.dc.actionpanel.datasource.ActionCostSourceImpl)

Aggregations

ActionCostTooltip (eidolons.libgdx.gui.panels.dc.actionpanel.tooltips.ActionCostTooltip)4 ActionValueContainer (eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer)2 ActionCostSourceImpl (eidolons.libgdx.gui.panels.dc.actionpanel.datasource.ActionCostSourceImpl)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 ObjType (main.entity.type.ObjType)1