Search in sources :

Example 1 with PHASE_TYPE

use of main.system.graphics.AnimPhase.PHASE_TYPE in project Eidolons by IDemiurge.

the class ActionAnimation method getImageMapFromIds.

protected Map<Image, String> getImageMapFromIds(Attack attack, Map<MOD_IDENTIFIER, String> map) {
    Map<Image, String> iconMap = new XLinkedMap<>();
    subPhaseTypeMap = new XLinkedMap<>();
    for (MOD_IDENTIFIER modId : map.keySet()) {
        Image image = modId.getImage(map.get(modId), attack);
        PHASE_TYPE phaseType = getSubPhaseTypeForKey(modId);
        if (phaseType == null) {
            getSubPhaseTooltipMap().put(image, getTooltip(modId));
        }
        subPhaseTypeMap.put(image, phaseType);
        iconMap.put(image, map.get(modId));
    }
    return iconMap;
}
Also used : MOD_IDENTIFIER(eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER) XLinkedMap(main.data.XLinkedMap) PHASE_TYPE(main.system.graphics.AnimPhase.PHASE_TYPE)

Example 2 with PHASE_TYPE

use of main.system.graphics.AnimPhase.PHASE_TYPE in project Eidolons by IDemiurge.

the class ActionAnimation method drawIconMap.

protected void drawIconMap(Map<Image, String> map, boolean horizontal, int wrap, boolean mouseMap, Font font, int base, int rows, boolean onTarget, boolean inverse, Boolean bonus_mod_other) {
    // if (map.isEmpty())
    // return;
    List<Map<Image, String>> splitMaps = new MapMaster<Image, String>().splitMap(map, wrap);
    // font);
    for (Map<Image, String> map1 : splitMaps) {
        fillTextRowWithDarkBackground(!onTarget, base + MAX_MINI_ICON_SIZE + getIconMapOffsetY(), font);
        int i = 0;
        for (Image image : map1.keySet()) {
            // StringMaster.wrapInParenthesis(s);
            if (image == null) {
                LogMaster.log(1, "********** null image in " + map1);
                continue;
            }
            Loop loop = new Loop(10);
            while (image.getWidth(null) < 1 && loop.continues()) {
                WaitMaster.WAIT(50);
            }
            if (image.getWidth(null) < 1) {
                LogMaster.log(1, "********** invalid image for " + map1.get(image));
                continue;
            }
            String s = map1.get(image);
            // ImageManager.getImageForDamageFormulaKey(s);
            int height = image.getHeight(null);
            int width = image.getWidth(null);
            // TODO finish
            int y = horizontal ? base : 0;
            int itemWidth = w / wrap;
            int x = itemWidth * i;
            if (map1.size() < wrap) {
                x = MigMaster.getCenteredPosition(w, itemWidth * map1.size()) + (i) * itemWidth;
            }
            drawOn(!onTarget, image, x, y);
            if (mouseMap) {
                PHASE_TYPE arg = null;
                if (subPhaseTypeMap != null) {
                    arg = subPhaseTypeMap.get(image);
                }
                if (arg == null) {
                    addMouseItem(false, x, y, width, height, new MouseItemImpl(MOUSE_ITEM.TOOLTIP, getSubPhaseTooltipMap().get(image)));
                } else {
                    addMouseItem(false, x, y, width, height, new MouseItemImpl(MOUSE_ITEM.SUB_PHASE, arg));
                }
            }
            // addToolTip(s+modsMap.getOrCreate(s));
            y += // ((inverse) ? -1 : 1) *
            (MAX_MINI_ICON_SIZE + getIconMapOffsetY());
            Integer mod = StringMaster.getInteger(s);
            Color color = getColorForModifier(mod);
            String text = s;
            if (bonus_mod_other != null) {
                text = bonus_mod_other ? StringMaster.getBonusString(mod) : StringMaster.getModifierString(mod);
            }
            x += (width - FontMaster.getStringWidth(font, text)) / 2;
            drawTextOn(!onTarget, text, font, x, y - fontHeight / 2, color);
            i++;
        }
        base = base + ((!inverse) ? 1 : -1) * (MAX_MINI_ICON_SIZE + getIconMapOffsetY() + FontMaster.getFontHeight(font) / 2);
    }
}
Also used : Loop(main.system.auxiliary.Loop) PHASE_TYPE(main.system.graphics.AnimPhase.PHASE_TYPE) XLinkedMap(main.data.XLinkedMap)

Example 3 with PHASE_TYPE

use of main.system.graphics.AnimPhase.PHASE_TYPE in project Eidolons by IDemiurge.

the class AnimationManager method cloneWithPhases.

public PhaseAnimation cloneWithPhases(PhaseAnimation anim, PHASE_TYPE... phaseTypes) {
    PhaseAnimation newAnim = (PhaseAnimation) anim.clone();
    List<PHASE_TYPE> phaseList = new ArrayList<>(Arrays.asList(phaseTypes));
    for (AnimPhase phase : anim.getPhases()) {
        if (phaseList.contains(phase.getType())) {
            newAnim.addPhase(new AnimPhase(phase.getType(), phase.getArgs()));
        }
    }
    return newAnim;
}
Also used : AnimPhase(main.system.graphics.AnimPhase) PHASE_TYPE(main.system.graphics.AnimPhase.PHASE_TYPE)

Example 4 with PHASE_TYPE

use of main.system.graphics.AnimPhase.PHASE_TYPE in project Eidolons by IDemiurge.

the class PhaseAnimation method getFilteredClone.

@Override
public ANIM getFilteredClone(PHASE_TYPE... allowedTypes) {
    ANIM clone = clone();
    clone.getPhases().clear();
    for (PHASE_TYPE type : allowedTypes) {
        AnimPhase animPhase = getPhase(type);
        if (animPhase != null) {
            clone.addPhase(animPhase);
        }
    }
    return clone;
}
Also used : PHASE_TYPE(main.system.graphics.AnimPhase.PHASE_TYPE)

Aggregations

PHASE_TYPE (main.system.graphics.AnimPhase.PHASE_TYPE)4 XLinkedMap (main.data.XLinkedMap)2 MOD_IDENTIFIER (eidolons.game.battlecraft.rules.combat.attack.AttackCalculator.MOD_IDENTIFIER)1 Loop (main.system.auxiliary.Loop)1 AnimPhase (main.system.graphics.AnimPhase)1