Search in sources :

Example 6 with ValueTooltip

use of eidolons.libgdx.gui.tooltips.ValueTooltip in project Eidolons by IDemiurge.

the class InitiativePanel method init.

private void init() {
    queue = new QueueViewContainer[maxSize];
    queueGroup = new WidgetGroup();
    queueGroup.setBounds(0, 0, imageSize * visualSize + (offset - 1) * visualSize, imageSize);
    container = new Container<>(queueGroup);
    container.setBounds(imageSize - offset, queueOffsetY, imageSize * visualSize + (offset - 1) * visualSize, imageSize);
    container.left().bottom();
    if (ExplorationMaster.isExplorationOn()) {
        container.setY(imageSize);
        container.setVisible(false);
    }
    addActor(container);
    final TextureRegion textureRegion = getOrCreateR(StrPathBuilder.build("UI", "components", "2017", "panels", "initiativepanel", "initiativePanel plain.png"));
    panelImage = new ValueContainer(textureRegion);
    // 
    panelImage.setPosition(50, 25 + queueOffsetY);
    // image.align(Align.bottomLeft);
    // image.overrideImageSize(imageSize, imageSize);
    // image.setSize(imageSize, imageSize);
    ValueTooltip tooltip = new ValueTooltip();
    tooltip.setUserObject(Arrays.asList(new ValueContainer("Good time to die!", "")));
    panelImage.addListener(tooltip.getController());
    addActor(panelImage);
    // panelImage.setPosition(0, -textureRegion.getRegionHeight());
    setBounds(0, 0, imageSize * visualSize + (offset - 1) * visualSize, // textureRegion.getRegionHeight()
    imageSize + queueOffsetY);
    light = new SuperContainer(new Image(TextureCache.getOrCreateR(SHADE_LIGHT.LIGHT_EMITTER.getTexturePath())), true);
    clock = animatedClock ? createAnimatedClock() : new SuperContainer(new Image(TextureCache.getOrCreateR(StrPathBuilder.build("UI", "components", "2017", "panels", "initiativepanel", "clock.png"))), true) {

        @Override
        protected float getAlphaFluctuationMin() {
            return 0.6f;
        }

        @Override
        protected float getAlphaFluctuationPerDelta() {
            return super.getAlphaFluctuationPerDelta() / 3;
        }
    };
    clock.addListener(getClockListener());
    addActor(light);
    light.setPosition(-15, -14);
    addActor(clock);
    clock.setPosition(-23, -31);
    timeLabel = new Label("Time", StyleHolder.getSizedLabelStyle(FONT.NYALA, 22));
    addActor(timeLabel);
    timeLabel.setPosition(15, 100);
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) SuperContainer(eidolons.libgdx.bf.generic.SuperContainer) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) WidgetGroup(com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Example 7 with ValueTooltip

use of eidolons.libgdx.gui.tooltips.ValueTooltip in project Eidolons by IDemiurge.

the class OrbsPanel method addTooltip.

public static void addTooltip(OrbElement el, String name, String val) {
    ValueTooltip tooltip = new ValueTooltip();
    tooltip.setUserObject(Arrays.asList(new ValueContainer(el.getIconRegion(), name, val)));
    el.addListener(tooltip.getController());
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Example 8 with ValueTooltip

use of eidolons.libgdx.gui.tooltips.ValueTooltip in project Eidolons by IDemiurge.

the class EditorPalette method init.

public void init() {
    clearChildren();
    clearListeners();
    addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // updateRequired=true;
            return super.touchDown(event, x, y, pointer, button);
        }
    });
    setSize(GdxMaster.getWidth() / 3 * 2, 256);
    int columns = (int) (getWidth() / 64);
    for (EDITOR_PALETTE sub : EDITOR_PALETTE.values()) {
        OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(sub.name());
        if (TYPE == null) {
            addCustomTab(sub);
            continue;
        }
        TabbedPanel tabbedPanel = new TabbedPanel();
        TablePanel<Actor> table;
        if (TYPE == null)
            continue;
        List<String> list = DataManager.getTabsGroup(TYPE);
        if (list.isEmpty())
            list.add("");
        for (String group : list) {
            table = new TablePanel<>();
            table.defaults().width(64).height(64);
            table.top().left().padLeft(64).padTop(64);
            table.setFillParent(true);
            ArrayList<ObjType> types = new ArrayList<>(DataManager.getTypesGroup(TYPE, group));
            int i = 0;
            int rows = 0;
            for (ObjType type : types) {
                TextureRegion texture = TextureCache.getOrCreateR(type.getImagePath());
                ValueContainer item = new ValueContainer(texture);
                item.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
                item.overrideImageSize(64, 64);
                item.addListener(new ValueTooltip(type.getName()).getController());
                item.addListener(getItemListener(item));
                table.add(item).left();
                item.setUserObject(type);
                i++;
                if (i >= columns) {
                    i = 0;
                    table.row();
                    rows++;
                }
            }
            table.pack();
            if (rows > 3) {
                ScrollPanel scrollPanel = new ScrollPanel();
                scrollPanel.addElement(table);
                tabbedPanel.addTab(scrollPanel, group);
            } else {
                tabbedPanel.addTab(table, group);
            }
        }
        addTab(tabbedPanel, sub.name());
    }
// scrollable?
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) OBJ_TYPE(main.content.OBJ_TYPE) ArrayList(java.util.ArrayList) TabbedPanel(eidolons.libgdx.gui.panels.TabbedPanel) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ObjType(main.entity.type.ObjType) Actor(com.badlogic.gdx.scenes.scene2d.Actor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) ScrollPanel(eidolons.libgdx.gui.panels.ScrollPanel) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 9 with ValueTooltip

use of eidolons.libgdx.gui.tooltips.ValueTooltip in project Eidolons by IDemiurge.

the class InventoryValueContainer method init.

@Override
protected void init(TextureRegion texture, String name, String value) {
    super.init(texture, "", "");
    addListener(new ValueTooltip(name).getController());
    addListener(new ClickListener(-1) {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            final int tapCount = this.getTapCount();
            final boolean isRightClicked = event.getButton() == Input.Buttons.RIGHT;
            final boolean isAltPressed = Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) || Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT);
            handler.cellClicked(cellType, tapCount, isRightClicked, isAltPressed, entity);
            event.stop();
        }
    });
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 10 with ValueTooltip

use of eidolons.libgdx.gui.tooltips.ValueTooltip 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)

Aggregations

ValueTooltip (eidolons.libgdx.gui.tooltips.ValueTooltip)10 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)9 VerticalValueContainer (eidolons.libgdx.gui.generic.VerticalValueContainer)4 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)3 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 PARAMS (eidolons.content.PARAMS)2 ArrayList (java.util.ArrayList)2 PARAMETER (main.content.values.parameters.PARAMETER)2 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)2 Pair (org.apache.commons.lang3.tuple.Pair)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 WidgetGroup (com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)1 ValuePages (eidolons.content.ValuePages)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)1