Search in sources :

Example 26 with OBJ_TYPE

use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.

the class RandomWizard method constructWeightMap.

public WeightMap<E> constructWeightMap(String property, Class<? extends E> CLASS, OBJ_TYPE TYPE, boolean inverse) {
    WeightMap<E> map = new WeightMap<>();
    if (inverse) {
        invertedMap = new LinkedHashMap<>();
    }
    for (String string : StringMaster.open(property)) {
        Integer value = 0;
        try {
            value = StringMaster.getWeight(string, inverse);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
        if (value <= 0) {
            value = 1;
        }
        string = StringMaster.getWeightItem(string, inverse);
        E object;
        if (CLASS != ObjType.class) {
            object = new EnumMaster<E>().retrieveEnumConst(CLASS, string);
        } else {
            object = (E) DataManager.getType(string, TYPE);
            if (object == null) {
                object = (E) DataManager.findType(string, TYPE);
            }
        }
        // if (object != null) //EMPTY option allowed!
        map.put(object, value);
        if (inverse) {
            invertedMap.put(value, object);
        }
    }
    return map;
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) WeightMap(main.system.datatypes.WeightMap)

Example 27 with OBJ_TYPE

use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.

the class MacroManager method initCustomTypes.

private static void initCustomTypes() {
    customTypes = new DequeImpl<>();
    custom_OBJ_TYPES = new DequeImpl<>();
    for (OBJ_TYPE t : MACRO_OBJ_TYPES.values()) {
        File file = FileManager.getFile(getTypeDataPath() + t.getName() + ".xml");
        if (!file.isFile()) {
            continue;
        }
        custom_OBJ_TYPES.add(t);
        String xml = FileManager.readFile(file);
        customTypes.addAll(XML_Reader.createCustomTypeList(xml, t, MacroGame.getGame(), !isEditMode(), true, false));
    // full type data or on top of base type?
    }
    for (ObjType type : customTypes) {
        type.setGenerated(true);
        DataManager.addType(type);
    }
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) ObjType(main.entity.type.ObjType) File(java.io.File)

Example 28 with OBJ_TYPE

use of main.content.OBJ_TYPE 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 29 with OBJ_TYPE

use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.

the class AutoTargeting method select.

@Override
public boolean select(Ref ref) {
    if (group != null) {
        if (getConditions() != null) {
            Set<Obj> filteredGroup = new Filter<Obj>(group.getObjects(), ref, getConditions()).getObjects();
            group = new GroupImpl(filteredGroup);
        }
        ref.setGroup(this.group);
        return true;
    }
    if (keyword != null) {
        Obj obj = ref.getObj(keyword);
        if (obj == null) {
            return false;
        }
        ref.setTarget(obj.getId());
        return true;
    }
    filter = new Filter<>(ref, getConditions());
    filter.setTYPE(TYPE);
    if (TYPES != null) {
        ArrayList<OBJ_TYPE> types = new ArrayList<>();
        for (String s : StringMaster.open(TYPES)) {
            types.add(ContentManager.getOBJ_TYPE(s));
        }
        filter.setTYPES(types);
    }
    setRef(ref);
    if (unlimitedTargets) {
        ref.setGroup(filter.getGroup());
    } else {
        setLastTarget(ref.getTargetObj());
        int nOfTargets = numberOfTargets.getInt(ref);
        if (nOfTargets <= 0) {
            return false;
        }
        Set<Obj> objects = filter.getObjects();
        if (nOfTargets == 1) {
            Obj obj = selectObj(objects);
            ref.setTarget(obj.getId());
        } else {
            GroupImpl group = filterGroup(filter.getGroup(), nOfTargets);
            ref.setGroup(group);
        }
    }
    return true;
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) Obj(main.entity.obj.Obj) GroupImpl(main.entity.group.GroupImpl) ArrayList(java.util.ArrayList)

Example 30 with OBJ_TYPE

use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.

the class DemoManager method initHero.

private static void initHero() {
    // TODO JUST USE 'CHOOSE CENTER HERO' ?
    List<ObjType> demoHeroes = new ArrayList<>();
    DataManager.getTypesSubGroup(DC_TYPE.CHARS, "Demo");
    Unit entity = null;
    ChoiceSequence sequence = new ChoiceSequence();
    sequence.addView(new EntityChoiceView(sequence, entity, demoHeroes) {

        @Override
        public String getInfo() {
            return null;
        }

        @Override
        protected PROPERTY getPROP() {
            return null;
        }

        // @Override
        // protected Condition getFilterConditions() {
        // //                return new NumericCondition("level");
        // }
        @Override
        protected VALUE getFilterValue() {
            return null;
        }

        protected OBJ_TYPE getTYPE() {
            return DC_TYPE.CHARS;
        }
    });
    sequence.setManager(new SequenceManager() {

        @Override
        public void doneSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.SELECTION, sequence.getValue());
            Launcher.resetView(VIEWS.HC);
            // setLeader()
            PartyHelper.loadParty(demoParty);
        // initSelectedHero();
        // newParty();
        // launchHC();
        }

        @Override
        public void cancelSelection() {
        }
    });
    sequence.start();
}
Also used : EntityChoiceView(eidolons.client.cc.gui.neo.choice.EntityChoiceView) OBJ_TYPE(main.content.OBJ_TYPE) ObjType(main.entity.type.ObjType) PROPERTY(main.content.values.properties.PROPERTY) ArrayList(java.util.ArrayList) ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) VALUE(main.content.VALUE) Unit(eidolons.entity.obj.unit.Unit) SequenceManager(eidolons.client.dc.SequenceManager)

Aggregations

OBJ_TYPE (main.content.OBJ_TYPE)31 ObjType (main.entity.type.ObjType)16 C_OBJ_TYPE (main.content.C_OBJ_TYPE)7 ArrayList (java.util.ArrayList)5 PROPERTY (main.content.values.properties.PROPERTY)5 Obj (main.entity.obj.Obj)5 Entity (main.entity.Entity)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 Unit (eidolons.entity.obj.unit.Unit)2 File (java.io.File)2 VALUE (main.content.VALUE)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)1 EntityChoiceView (eidolons.client.cc.gui.neo.choice.EntityChoiceView)1 HC_PagedListPanel (eidolons.client.cc.gui.pages.HC_PagedListPanel)1 SequenceManager (eidolons.client.dc.SequenceManager)1