Search in sources :

Example 26 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class TooltipFactory method getValueContainer.

protected ValueContainer getValueContainer(BattleFieldObject hero, PARAMS cur, PARAMS max) {
    final Integer cv = StringMaster.getInteger(hero.getCachedValue(max));
    final Integer v = hero.getIntParam(cur);
    final String name = max.getDisplayedName();
    final TextureRegion iconTexture = TextureCache.getOrCreateR(ImageManager.getValueIconPath(max));
    final ValueContainer valueContainer = new ValueContainer(iconTexture, name, v + "/" + cv);
    valueContainer.setNameAlignment(Align.left);
    valueContainer.setValueAlignment(Align.right);
    return valueContainer;
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Example 27 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class UnitViewTooltipFactory method supplier.

@Override
protected Supplier<List<ValueContainer>> supplier(BattleFieldObject hero) {
    return () -> {
        List<ValueContainer> values = new ArrayList<>();
        if (hero.checkSelectHighlighted()) {
            String actionTargetingTooltip = "";
            DC_ActiveObj action = (DC_ActiveObj) hero.getGame().getManager().getActivatingAction();
            try {
                actionTargetingTooltip = ToolTipMaster.getActionTargetingTooltip(hero, action);
            } catch (Exception e) {
                if (!action.isBroken()) {
                    main.system.ExceptionMaster.printStackTrace(e);
                } else {
                    action.setBroken(true);
                }
            }
            if (!StringMaster.isEmpty(actionTargetingTooltip)) {
                final ValueContainer activationTooltip = new ValueContainer(actionTargetingTooltip, "");
                activationTooltip.setNameAlignment(Align.left);
                values.add(activationTooltip);
            }
        }
        if (!hero.isMine())
            if (!hero.getGame().isDebugMode())
                if (hero.getVisibilityLevelForPlayer() != VISIBILITY_LEVEL.CLEAR_SIGHT) {
                    final ValueContainer nameContainer = new ValueContainer(hero.getToolTip(), "");
                    nameContainer.setNameAlignment(Align.left);
                    values.add(nameContainer);
                    if (hero.getGame().isStarted())
                        if (hero.getUnitVisionStatus() != null) {
                            final ValueContainer valueContainer = new ValueContainer(StringMaster.getWellFormattedString(hero.getUnitVisionStatus().name()), "");
                            valueContainer.setNameAlignment(Align.left);
                            values.add(valueContainer);
                        }
                    String text = hero.getGame().getVisionMaster().getHintMaster().getHintsString(hero);
                    TextureRegion texture = TextureCache.getOrCreateR(VISUALS.QUESTION.getImgPath());
                    final ValueContainer hintsContainer = new ValueContainer(texture, text);
                    hintsContainer.setNameAlignment(Align.left);
                    hintsContainer.setValueAlignment(Align.right);
                    values.add(hintsContainer);
                    return values;
                }
        final ValueContainer nameContainer = new ValueContainer(hero.getToolTip(), "");
        nameContainer.setNameAlignment(Align.left);
        values.add(nameContainer);
        INFO_LEVEL info_level = new EnumMaster<INFO_LEVEL>().retrieveEnumConst(INFO_LEVEL.class, OptionsMaster.getGameplayOptions().getValue(GAMEPLAY_OPTION.INFO_DETAIL_LEVEL));
        values.add(getValueContainer(hero, PARAMS.C_TOUGHNESS, PARAMS.TOUGHNESS));
        values.add(getValueContainer(hero, PARAMS.C_ENDURANCE, PARAMS.ENDURANCE));
        if (info_level != null)
            switch(info_level) {
                case VERBOSE:
                    values.add(getValueContainer(hero, PARAMS.C_STAMINA, PARAMS.STAMINA));
                    values.add(getValueContainer(hero, PARAMS.C_FOCUS, PARAMS.FOCUS));
                    values.add(getValueContainer(hero, PARAMS.C_MORALE, PARAMS.MORALE));
                    values.add(getValueContainer(hero, PARAMS.C_ESSENCE, PARAMS.ESSENCE));
                case NORMAL:
                    addParamStringToValues(hero, values, PARAMS.ARMOR);
                    addParamStringToValues(hero, values, PARAMS.RESISTANCE);
                case BASIC:
                    addParamStringToValues(hero, values, PARAMS.DAMAGE);
                    addParamStringToValues(hero, values, PARAMS.ATTACK);
                    addParamStringToValues(hero, values, PARAMS.DEFENSE);
            }
        if (hero.getIntParam(PARAMS.N_OF_ACTIONS) > 0) {
            values.add(getValueContainer(hero, PARAMS.C_N_OF_ACTIONS, PARAMS.N_OF_ACTIONS));
        }
        if (hero.getIntParam(PARAMS.N_OF_COUNTERS) > 0) {
            values.add(getValueContainer(hero, PARAMS.C_N_OF_COUNTERS, PARAMS.N_OF_COUNTERS));
        }
        if (hero.getGame().isDebugMode()) {
            ValueContainer valueContainer = new ValueContainer("coord:", hero.getCoordinates().toString());
            valueContainer.setNameAlignment(Align.left);
            valueContainer.setValueAlignment(Align.right);
            values.add(valueContainer);
            if (hero.getFacing() != null || hero.getDirection() != null) {
                final String name = "direction: " + (hero.getFacing() != null ? hero.getFacing().getDirection() : hero.getDirection());
                valueContainer = new ValueContainer(name, hero.getCoordinates().toString());
                valueContainer.setNameAlignment(Align.left);
                valueContainer.setValueAlignment(Align.right);
                values.add(valueContainer);
            }
        }
        if (hero instanceof Unit) {
            addPropStringToValues(hero, values, G_PROPS.MODE);
            addPropStringToValues(hero, values, G_PROPS.STATUS);
        }
        if (hero.getCustomParamMap() != null) {
            hero.getCustomParamMap().keySet().forEach(counter -> {
                final String name = StringMaster.getWellFormattedString(counter);
                String img = CounterMaster.getImagePath(counter);
                if (img != null) {
                    TextureRegion texture = TextureCache.getOrCreateR(img);
                    final ValueContainer valueContainer = (texture == null) ? new ValueContainer(name, hero.getCustomParamMap().get(counter)) : new ValueContainer(texture, name, hero.getCustomParamMap().get(counter));
                    valueContainer.setNameAlignment(Align.left);
                    valueContainer.setValueAlignment(Align.right);
                    values.add(valueContainer);
                }
            });
        }
        // if (VisionManager.isVisibilityOn()){
        if (RuleMaster.isRuleOn(RULE.VISIBILITY) || Eidolons.game.isDebugMode()) {
            addParamStringToValues(hero, values, PARAMS.LIGHT_EMISSION);
            addParamStringToValues(hero, values, PARAMS.ILLUMINATION);
            addParamStringToValues(hero, values, PARAMS.CONCEALMENT);
        // addKeyAndValue("Gamma", ""+hero.getGame().getVisionMaster().
        // getGammaMaster().
        // getGamma(false, hero.getGame().getManager().getActiveObj(), hero), values);
        }
        if (hero.getGame().isDebugMode()) {
            final ValueContainer outlineContainer = new ValueContainer(StringMaster.getWellFormattedString(hero.getOutlineTypeForPlayer() + ""), "");
            outlineContainer.setNameAlignment(Align.left);
            values.add(outlineContainer);
            final ValueContainer outlineContainer2 = new ValueContainer(StringMaster.getWellFormattedString(hero.getVisibilityLevel() + ""), "");
            outlineContainer.setNameAlignment(Align.left);
            values.add(outlineContainer);
        }
        return values;
    };
}
Also used : Arrays(java.util.Arrays) ToolTipMaster(eidolons.system.text.ToolTipMaster) PARAMS(eidolons.content.PARAMS) Supplier(java.util.function.Supplier) StringMaster(main.system.auxiliary.StringMaster) CounterMaster(main.system.entity.CounterMaster) ArrayList(java.util.ArrayList) RULE(eidolons.game.battlecraft.rules.RuleMaster.RULE) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) OptionsMaster(eidolons.system.options.OptionsMaster) G_PROPS(main.content.values.properties.G_PROPS) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) Align(com.badlogic.gdx.utils.Align) VISIBILITY_LEVEL(main.content.enums.rules.VisionEnums.VISIBILITY_LEVEL) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) List(java.util.List) TextureCache(eidolons.libgdx.texture.TextureCache) Eidolons(eidolons.game.core.Eidolons) GAMEPLAY_OPTION(eidolons.system.options.GameplayOptions.GAMEPLAY_OPTION) BaseView(eidolons.libgdx.bf.grid.BaseView) RuleMaster(eidolons.game.battlecraft.rules.RuleMaster) VISUALS(main.swing.generic.components.G_Panel.VISUALS) Unit(eidolons.entity.obj.unit.Unit) EnumMaster(main.system.auxiliary.EnumMaster) INFO_LEVEL(main.content.enums.rules.VisionEnums.INFO_LEVEL) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) EnumMaster(main.system.auxiliary.EnumMaster) INFO_LEVEL(main.content.enums.rules.VisionEnums.INFO_LEVEL) ArrayList(java.util.ArrayList) List(java.util.List) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Unit(eidolons.entity.obj.unit.Unit)

Example 28 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class ArmorPanel method updateAct.

@Override
public void updateAct(float delta) {
    clear();
    final ArmorDataSource source = (ArmorDataSource) getUserObject();
    addElement(source.getArmorObj()).center().fill(false);
    row();
    for (ValueContainer valueContainer : source.getParamValues()) {
        valueContainer.setBorder(getOrCreateR("UI/components/infopanel/simple_value_border.png"));
        addElement(valueContainer);
        row();
    }
}
Also used : ArmorDataSource(eidolons.libgdx.gui.panels.dc.unitinfo.datasource.ArmorDataSource) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Example 29 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class AttackTooltip method updateAct.

@Override
public void updateAct(float delta) {
    clear();
    TablePanel left = new TablePanel();
    final ActionTooltipSource source = (ActionTooltipSource) getUserObject();
    final MultiValueContainer valueContainer = source.getHead();
    final List<Container<Label>> values = valueContainer.getValues();
    final TextureRegion leftImage = getOrCreateR(values.get(0).getActor().getText().toString());
    final TextureRegion rightImage = getOrCreateR(values.get(1).getActor().getText().toString());
    baseTable = new TablePanel();
    baseTable.addElement(null).expand(0, 0).fill(false);
    baseTable.addElement(new ValueContainer(valueContainer.getName(), ""));
    baseTable.addElement(new ValueContainer(leftImage));
    baseTable.addElement(new ValueContainer(rightImage));
    baseTable.row();
    ValueContainer precalcRow = source.getPrecalcRow();
    if (precalcRow != null) {
        Label label = new Label("Est.", StyleHolder.getDefaultLabelStyle());
        baseTable.addElement(label);
        baseTable.addElement(precalcRow);
        baseTable.row();
    }
    List<MultiValueContainer> list = source.getBase();
    for (Object o : list) {
        MultiValueContainer container = (MultiValueContainer) o;
        final List<ValueContainer> separated = container.separate();
        separated.forEach(el -> {
            baseTable.addElement(el);
        });
        baseTable.row();
    }
    rangeTable = new TablePanel();
    list = source.getRange();
    for (Object o : list) {
        MultiValueContainer container = (MultiValueContainer) o;
        final List<ValueContainer> separated = container.separate();
        separated.forEach(el -> {
            rangeTable.addElement(el);
        });
        rangeTable.row();
    }
    List<List<ValueContainer>> listText = source.getText();
    for (List<ValueContainer> valueContainers : listText) {
        TablePanel panel = new TablePanel();
        textTables.add(panel);
        for (ValueContainer container : valueContainers) {
            // container.wrapNames();
            panel.addElement(container);
            panel.row();
        }
    }
    left.addElement(baseTable).width(282).pad(0, 0, 3, 0);
    left.row();
    left.addElement(rangeTable).width(282).pad(0, 0, 3, 0);
    left.row();
    textTables.forEach(el -> {
        left.addElement(el).width(282).pad(0, 0, 3, 0);
        left.row();
    });
    addElement(left);
    CostsPanel costsPanel = new CostsPanel();
    costsPanel.setUserObject(source.getCostsSource());
    addElement(costsPanel);
}
Also used : Label(com.badlogic.gdx.scenes.scene2d.ui.Label) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) Container(com.badlogic.gdx.scenes.scene2d.ui.Container) ArrayList(java.util.ArrayList) List(java.util.List) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 30 with ValueContainer

use of eidolons.libgdx.gui.generic.ValueContainer in project Eidolons by IDemiurge.

the class AttackTooltipFactory method createPrecalcRow.

private static ValueContainer createPrecalcRow(boolean precalc, DC_UnitAction el, DC_Obj target) {
    if (!precalc) {
        return null;
    }
    int min_damage = FutureBuilder.precalculateDamage(el, target, true, true);
    int max_damage = FutureBuilder.precalculateDamage(el, target, true, false);
    DAMAGE_TYPE dmgType = el.getDamageType();
    // TODO display all bonus damage!
    // Attack attack = EffectFinder.getAttackFromAction(el);
    // DamageFactory.getDamageFromAttack();
    String info = min_damage + "-" + max_damage + dmgType.getName() + " damage";
    String tooltip = "";
    // if ()
    // DamageCalculator.isUnconscious()
    // "(will drop)";
    // tooltip +=" (shield!)";
    ValueContainer container = new ValueContainer(info, tooltip);
    return container;
}
Also used : DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) MultiValueContainer(eidolons.libgdx.gui.panels.dc.unitinfo.MultiValueContainer) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer)

Aggregations

ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)38 ValueTooltip (eidolons.libgdx.gui.tooltips.ValueTooltip)12 ArrayList (java.util.ArrayList)12 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)10 VerticalValueContainer (eidolons.libgdx.gui.generic.VerticalValueContainer)8 List (java.util.List)8 PARAMS (eidolons.content.PARAMS)7 DC_UnitAction (eidolons.entity.active.DC_UnitAction)5 TextureCache (eidolons.libgdx.texture.TextureCache)5 Arrays (java.util.Arrays)5 PARAMETER (main.content.values.parameters.PARAMETER)5 G_PROPS (main.content.values.properties.G_PROPS)5 Pair (org.apache.commons.lang3.tuple.Pair)5 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)4 UNIT_INFO_PARAMS (eidolons.content.UNIT_INFO_PARAMS)4 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)4 Unit (eidolons.entity.obj.unit.Unit)4 TablePanel (eidolons.libgdx.gui.panels.TablePanel)4 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)4 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)3