Search in sources :

Example 1 with PointComp

use of main.swing.generic.misc.PointComp in project Eidolons by IDemiurge.

the class PointView method stateChanged.

@Override
public void stateChanged(ChangeEvent e) {
    // subtract points from attr/mast? only down to X!
    int newValue = (int) ((PointComp) e.getSource()).getValue();
    PARAMETER param = ((PointComp) e.getSource()).getParam();
    int oldValue = getBufferType().getIntParam(param);
    int mod = newValue - oldValue;
    int cost = PointMaster.getPointCost(Math.max(newValue, oldValue), hero, param);
    if (mod < 0 || !checkCost(cost * mod)) {
        ((PointComp) e.getSource()).removeChangeListener(this);
        ((PointComp) e.getSource()).setValue(oldValue);
        ((PointComp) e.getSource()).addChangeListener(this);
        return;
    }
    // CharacterCreator.getHeroManager().modifyHeroParam(hero, param, mod);
    getBufferType().modifyParameter(param, mod);
    modifyPool(-mod, cost);
}
Also used : PointComp(main.swing.generic.misc.PointComp) PARAMETER(main.content.values.parameters.PARAMETER)

Example 2 with PointComp

use of main.swing.generic.misc.PointComp in project Eidolons by IDemiurge.

the class PointView method updateValuePanel.

private void updateValuePanel() {
    for (PARAMETER p : compMap.keySet()) {
        if (!getBufferType().getParam(p).equals(hero.getParam(p))) {
            Component comp = compMap.get(p);
            if (!editable) {
                ((JLabel) comp).setText(hero.getParam(p));
            } else {
                ((PointComp) comp).removeChangeListener(this);
                ((PointComp) comp).setValue(hero.getIntParam(p));
                ((PointComp) comp).addChangeListener(this);
            }
        }
    }
}
Also used : PointComp(main.swing.generic.misc.PointComp) PARAMETER(main.content.values.parameters.PARAMETER)

Example 3 with PointComp

use of main.swing.generic.misc.PointComp in project Eidolons by IDemiurge.

the class PointView method addValueComponent.

private void addValueComponent(PARAMETER value, int i, G_Panel valPanel) {
    String name = value.getName();
    if (editable && attributes) {
        name = name.replace(StringMaster.getWellFormattedString(StringMaster.BASE), "");
    }
    JLabel lbl = new JLabel(name + ": ");
    valPanel.add(lbl, "id lbl" + i + ", sg lbls");
    if (editable) {
        PointComp pc = new PointComp(getBufferType().getIntParam(value), attributes);
        // set minimum
        pc.setParam(value);
        pc.setFont(font);
        pc.addChangeListener(this);
        valPanel.add(pc, ((i % columns == 0) ? ",wrap" : ""));
        compMap.put(value, pc);
    } else {
        JLabel comp = new JLabel(getBufferType().getParam(value));
        comp.setFont(font);
        valPanel.add(comp, ((i % columns == 0) ? ",wrap" : ""));
        compMap.put(value, comp);
    }
}
Also used : PointComp(main.swing.generic.misc.PointComp)

Aggregations

PointComp (main.swing.generic.misc.PointComp)3 PARAMETER (main.content.values.parameters.PARAMETER)2