Search in sources :

Example 26 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class SessionMaster method createSessionFromText.

public static Session createSessionFromText(String text, boolean mergeWithLast) {
    String typeName = getSessionName(text);
    Entity oldType = null;
    if (mergeWithLast) {
        oldType = ZeitMaster.getLatest(AT_OBJ_TYPE.SESSION, true);
        typeName = oldType.getName();
        typeName = NameMaster.getUniqueVersionedName(DataManager.getTypes(AT_OBJ_TYPE.SESSION), typeName);
    }
    typeName = DialogMaster.inputText("Session/Outcome Name?", typeName);
    // TODO fill out - deadline, priority, type
    ObjType type = new ObjType(typeName, AT_OBJ_TYPE.SESSION);
    // type.setGroup(group, false);
    if (oldType != null) {
        type.copyValues(oldType, copiedVals);
        type.copyValues(oldType, ContentManager.getValuesForType(AT_OBJ_TYPE.SESSION.getName(), false));
    }
    Session session = getNewSession(type, false);
    CaptureParser.initSessionCapture(session, text);
    session.setLocked(true);
    // initSession(session);
    session.toBase();
    SessionWindow window = showInWindow(session);
    window.refresh();
    return session;
}
Also used : Entity(main.entity.Entity) ObjType(main.entity.type.ObjType) SessionWindow(main.gui.SessionWindow)

Example 27 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class TavernView method itemIndexSelected.

public void itemIndexSelected(int i) {
    this.setIndex(i);
    Unit e = data.get(getSelectedIndex());
    if (e instanceof Entity && infoPanel != null) {
        infoPanel.setEntity(e);
        infoPanel.refresh();
    }
    if (!isOkBlocked()) {
        // "hire"
        okButton.setVisuals(VISUALS.FORWARD);
    } else {
        okButton.setVisuals(VISUALS.FORWARD_BLOCKED);
    }
}
Also used : Entity(main.entity.Entity) Unit(eidolons.entity.obj.unit.Unit)

Example 28 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class FilterMaster method filter.

public static Collection<?> filter(Collection<?> list, String valueName, String value, OBJ_TYPE TYPE, boolean prop, boolean filterOut, Boolean strict_or_greater_less_equal) {
    List<Object> filteredList = new ArrayList<>();
    for (Object l : list) {
        Entity entity;
        if (l instanceof Entity) {
            entity = (Entity) l;
        } else {
            entity = DataManager.getType(l.toString(), TYPE);
        }
        if (entity == null) {
            continue;
        }
        boolean result;
        if (prop) {
            PROPERTY property = ContentManager.getPROP(valueName);
            if (property.isContainer()) // if (!BooleanMaster.isFalse(strict_or_greater_less_equal))
            {
                result = entity.checkContainerProp(property, value, strict_or_greater_less_equal == null);
            } else {
                result = StringMaster.compareByChar(entity.getProperty(property), value, BooleanMaster.isTrue(strict_or_greater_less_equal));
            }
        // entity.checkProperty();
        } else {
            PARAMETER param = ContentManager.getPARAM(valueName);
            int amount = new Formula(value).getInt(new Ref(entity));
            if (strict_or_greater_less_equal == null) {
                result = entity.getIntParam(param) == amount;
            } else {
                result = entity.checkParam(param, "" + amount);
                if (!strict_or_greater_less_equal) {
                    result = !result;
                }
            }
        }
        if (filterOut) {
            if (result) {
                filteredList.add(l);
            }
        } else if (!result) {
            filteredList.add(l);
        }
    }
    for (Object l : filteredList) {
        list.remove(l);
    }
    return list;
}
Also used : Entity(main.entity.Entity) Formula(main.system.math.Formula) Ref(main.entity.Ref) PROPERTY(main.content.values.properties.PROPERTY) ArrayList(java.util.ArrayList) PARAMETER(main.content.values.parameters.PARAMETER)

Example 29 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class ScenarioListPanel method toDataList.

@Override
public List<SelectableItemData> toDataList(List<? extends Entity> objTypes) {
    List<SelectableItemData> list = new LinkedList<>();
    for (Entity sub : objTypes) {
        SelectableItemData item = new SelectableItemData(sub);
        list.add(item);
        item.setDescription(HelpMaster.getScenarioInfoText(item.getName(), null));
        item.setPreviewImagePath(item.getEntity().getProperty(G_PROPS.FULLSIZE_IMAGE));
    }
    return list;
}
Also used : Entity(main.entity.Entity) LinkedList(java.util.LinkedList)

Example 30 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class ListItemMouseListener method mouseClicked.

@Override
public void mouseClicked(MouseEvent arg0) {
    JList source = (JList) arg0.getSource();
    if (ip != null) {
        Entity obj = DataManager.getType(source.getSelectedValue().toString(), TYPE);
        ip.setInfoObj(obj);
        ip.refresh();
    }
    if (arg0.isAltDown()) {
        buttonPanel.moveOne(SwingUtilities.isRightMouseButton(arg0));
        return;
    }
    if (SwingUtilities.isRightMouseButton(arg0)) {
        if (arg0.isAltDown()) {
            buttonPanel.edit();
        } else {
            buttonPanel.moveOne(arg0.getClickCount() > 1);
        }
        return;
    }
    if (arg0.getClickCount() > 1) {
        if (mode == SELECTION_MODE.SINGLE) {
        } else {
            if (source == getList()) {
                buttonPanel.add();
            } else {
                buttonPanel.removeOrAdd(mode);
            }
        }
    }
}
Also used : Entity(main.entity.Entity)

Aggregations

Entity (main.entity.Entity)41 ObjType (main.entity.type.ObjType)11 Unit (eidolons.entity.obj.unit.Unit)7 PARAMETER (main.content.values.parameters.PARAMETER)5 Obj (main.entity.obj.Obj)5 OBJ_TYPE (main.content.OBJ_TYPE)4 Ref (main.entity.Ref)4 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)3 DC_PagedInfoPanel (eidolons.swing.components.panels.page.info.DC_PagedInfoPanel)3 ArrayList (java.util.ArrayList)3 DC_TYPE (main.content.DC_TYPE)3 ITEM_SLOT (main.content.enums.entity.ItemEnums.ITEM_SLOT)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 LinkedList (java.util.LinkedList)2 ActiveObj (main.entity.obj.ActiveObj)2 ArcaneEntity (main.logic.ArcaneEntity)2 AtlasRegion (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion)1 Vector2 (com.badlogic.gdx.math.Vector2)1 ActionGenerator (eidolons.ability.ActionGenerator)1