use of eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer in project Eidolons by IDemiurge.
the class MapActionPanel method getActions.
private List<ActionValueContainer> getActions(MacroParty source) {
// cache
List<MacroAction> actions = MacroActionManager.getMacroActions(MACRO_ACTION_GROUPS.PARTY, source);
List<ActionValueContainer> list = new ArrayList<>();
for (MacroAction sub : actions) {
boolean valid = true;
TextureRegion texture = TextureCache.getOrCreateR(sub.getImagePath());
list.add(new ActionValueContainer(valid, texture, () -> {
sub.invokeClicked();
}));
}
return list;
}
use of eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer 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;
}
use of eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer 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;
}
use of eidolons.libgdx.gui.panels.dc.actionpanel.ActionValueContainer in project Eidolons by IDemiurge.
the class MapActionPanel method updateAct.
@Override
public void updateAct(float delta) {
clear();
final MacroParty source = (MacroParty) getUserObject();
final List<ActionValueContainer> sources = getActions(source);
initContainer(sources, "UI/EMPTY_LIST_ITEM.jpg");
}
Aggregations