Search in sources :

Example 1 with WORKSPACE_GROUP

use of main.content.enums.system.MetaEnums.WORKSPACE_GROUP in project Eidolons by IDemiurge.

the class EntityChoiceView method initData.

protected void initData() {
    if (list != null) {
        // empty?
        if (list.get(0) instanceof ObjType) {
            data = new ArrayList<>(new DequeImpl<ObjType>().getAddAllCast(list));
        } else {
        // TODO
        }
    } else {
        if (getGroup() != null) {
            data = DataManager.getFilteredTypes(getGroup(), getTYPE(), getFilterValue());
        } else {
            data = DataManager.getTypes(getTYPE());
        }
        Ref ref = new Ref(DC_Game.game);
        if (hero != null) {
            ref = Ref.getCopy(hero.getRef());
        }
        if (getFilterOption() != null) {
            WORKSPACE_GROUP ws = new EnumMaster<WORKSPACE_GROUP>().retrieveEnumConst(WORKSPACE_GROUP.class, getFilterOption());
            data = new Filter<ObjType>(ref, ConditionMaster.getWorkspaceCondition(true, ws)).filter(data);
        }
        if (getFilterConditions() != null) {
            data = new Filter<ObjType>(ref, getFilterConditions()).filter(data);
        }
    }
    sortData();
}
Also used : Ref(main.entity.Ref) WORKSPACE_GROUP(main.content.enums.system.MetaEnums.WORKSPACE_GROUP) ObjType(main.entity.type.ObjType) Filter(main.elements.Filter)

Example 2 with WORKSPACE_GROUP

use of main.content.enums.system.MetaEnums.WORKSPACE_GROUP in project Eidolons by IDemiurge.

the class CharacterCreator method saveAs.

public static void saveAs(ObjType type, boolean preset) {
    // choose new name
    boolean newVersion = false;
    // if (DataManager.isTypeName(name)) {
    new Thread(new Runnable() {

        public void run() {
            // This name has already been
            DialogMaster.ask(// This name has already been
            "Save as...", // do?
            true, "Overwrite", "New Hero", "New Version");
        }
    }).start();
    Boolean result = (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.OPTION_DIALOG);
    String name = type.getName();
    if (result == null) {
        name = NameMaster.appendVersionToName(name);
        newVersion = true;
    } else if (!result) {
        // TODO what if it's not the one?
        name = getHeroName(getHero());
        if (name == null) {
            return;
        }
        // saveAs(type, preset);
        return;
    }
    // }
    ObjType newType = new ObjType(type);
    newType.setProperty(G_PROPS.NAME, name);
    Simulation.getGame().initType(newType);
    if (!partyMode) {
        addHero(newType);
    }
    if (preset && !newVersion) {
        newType.setGroup(StringMaster.PRESET, false);
        String value = ListChooser.chooseEnum(CUSTOM_HERO_GROUP.class);
        if (value != null) {
            newType.setProperty(G_PROPS.CUSTOM_HERO_GROUP, value);
        }
        WORKSPACE_GROUP ws = getDefaultWorkspaceGroup();
        String string = ListChooser.chooseEnum(WORKSPACE_GROUP.class);
        if (string != null) {
            ws = new EnumMaster<WORKSPACE_GROUP>().retrieveEnumConst(WORKSPACE_GROUP.class, string);
        }
        newType.setWorkspaceGroup(ws);
    } else {
        newType.setGroup(getFilterGroup(), false);
        newType.setProperty(G_PROPS.CUSTOM_HERO_GROUP, StringMaster.getWellFormattedString(getDefaultSpecGroup().name()));
        newType.setWorkspaceGroup(getDoneWorkspaceGroup());
    // automatic ?
    }
    save(newType);
    DataManager.addType(newType);
    if (newVersion) {
        heroManager.applyChangedType(heroManager.getHero(type), newType);
    }
}
Also used : WORKSPACE_GROUP(main.content.enums.system.MetaEnums.WORKSPACE_GROUP) ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster)

Aggregations

WORKSPACE_GROUP (main.content.enums.system.MetaEnums.WORKSPACE_GROUP)2 ObjType (main.entity.type.ObjType)2 Filter (main.elements.Filter)1 Ref (main.entity.Ref)1 EnumMaster (main.system.auxiliary.EnumMaster)1