Search in sources :

Example 1 with OBJECTIVE_TYPE

use of eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE in project Eidolons by IDemiurge.

the class ObjectiveHelper method editObjectives.

public static void editObjectives(Obj mission) {
    List<String> objectiveTypes = StringMaster.openContainer(mission.getProperty(MACRO_PROPS.OBJECTIVE_TYPES));
    List<String> objectivesData = StringMaster.openContainer(mission.getProperty(MACRO_PROPS.OBJECTIVE_DATA));
    // assert equal size!
    // editObjective
    DialogMaster.ask("What to do about objectives?", true, "ADD", "REMOVE", "EDIT");
    Boolean add_remove_edit = (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.OPTION_DIALOG);
    if (add_remove_edit == null) {
        int index = 0;
        if (objectiveTypes.size() > 1) {
            index = // descriptive...
            DialogMaster.optionChoice(// descriptive...
            objectiveTypes.toArray(), "Which objective to edit?");
        // -1
        }
        OBJECTIVE_TYPE type = new EnumMaster<OBJECTIVE_TYPE>().retrieveEnumConst(OBJECTIVE_TYPE.class, objectiveTypes.get(index));
        String newData = objectivesData.get(index);
        // custom objective names!!! "Slay the Black Captain"
        if (DialogMaster.confirm("Edit string?")) {
            newData = DialogMaster.inputText("Edit data for " + objectiveTypes.get(index), objectivesData.get(index));
        } else {
            newData = inputObjectiveData(type);
        }
        objectivesData.set(index, newData);
    } else {
        if (add_remove_edit) {
            OBJECTIVE_TYPE type = new EnumMaster<OBJECTIVE_TYPE>().retrieveEnumConst(OBJECTIVE_TYPE.class, ListChooser.chooseEnum(OBJECTIVE_TYPE.class));
            String newData = inputObjectiveData(type);
            objectivesData.add(newData);
            objectiveTypes.add(type.toString());
        }
    }
    String data = StringMaster.constructContainer(objectivesData);
    String types = StringMaster.constructContainer(objectiveTypes);
    mission.setProperty(MACRO_PROPS.OBJECTIVE_DATA, data, true);
    mission.setProperty(MACRO_PROPS.OBJECTIVE_TYPES, types, true);
}
Also used : OBJECTIVE_TYPE(eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE)

Example 2 with OBJECTIVE_TYPE

use of eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE in project Eidolons by IDemiurge.

the class SkirmishMaster method newCustomSkirmish.

public static void newCustomSkirmish() {
    ChoiceSequence cs = new ChoiceSequence();
    new EnumChoiceView<>(cs, null, SKIRMISH_TYPE.class);
    // battlefield
    // max level
    // nemesis groups
    // objective
    // filtering based on chosen template/type/bf
    String info = "";
    String data = "";
    String path = PathFinder.getDungeonLevelFolder();
    final Map<String, File> map = new HashMap<>();
    for (File file : FileManager.getFilesFromDirectory(path, false)) {
        data += file.getName() + ";";
        map.put(file.getName(), file);
    }
    ListChoiceView battlefieldChoiceView = new ListChoiceView(cs, info, data) {

        public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
            return getBattlefieldImageAndText(map.get(value), value, isSelected);
        }
    };
    // filter!
    final ArrayList<OBJECTIVE_TYPE> allowed = new ArrayList<>();
    EnumChoiceView<OBJECTIVE_TYPE> objectiveChoiceView = new EnumChoiceView<OBJECTIVE_TYPE>(cs, null, OBJECTIVE_TYPE.class) {

        @Override
        public boolean isOkBlocked() {
            return allowed.contains(getSelectedItem());
        }
    };
    cs.addView(battlefieldChoiceView);
    // or mission?
    cs.addView(objectiveChoiceView);
    // mode choice
    // dungeon choice? mission type choice?
    cs.setManager(getChoiceMaster(map, battlefieldChoiceView, objectiveChoiceView));
    cs.start();
}
Also used : OBJECTIVE_TYPE(eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE) EnumChoiceView(eidolons.client.cc.gui.neo.choice.EnumChoiceView) HashMap(java.util.HashMap) ListChoiceView(eidolons.client.cc.gui.neo.choice.ListChoiceView) ArrayList(java.util.ArrayList) ChoiceSequence(eidolons.client.cc.gui.neo.choice.ChoiceSequence) File(java.io.File)

Example 3 with OBJECTIVE_TYPE

use of eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE in project Eidolons by IDemiurge.

the class SkirmishMaster method getChoiceMaster.

private static SequenceManager getChoiceMaster(final Map<String, File> map, final ListChoiceView battlefieldChoiceView, final EnumChoiceView<OBJECTIVE_TYPE> objectiveChoiceView) {
    return new SequenceManager() {

        @Override
        public void doneSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.CUSTOM_SELECT, true);
            Object bfName = battlefieldChoiceView.getSelectedItem();
            File file = map.get(bfName);
            if (!file.isFile()) {
                return;
            }
            // Dungeon dungeon = DungeonBuilder.buildDungeon(FileManager.readFile(file));
            // specified where? used
            ObjType missionType = new ObjType();
            // for
            // what?
            OBJECTIVE_TYPE objective = objectiveChoiceView.getSelectedItem();
            // initSkirmish(missionType, dungeon);
            Launcher.resetView(VIEWS.MENU);
        }

        @Override
        public void cancelSelection() {
            WaitMaster.receiveInput(WAIT_OPERATIONS.CUSTOM_SELECT, false);
            Launcher.getMainManager().exitToMainMenu();
        }
    };
}
Also used : OBJECTIVE_TYPE(eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE) ObjType(main.entity.type.ObjType) File(java.io.File) SequenceManager(eidolons.client.dc.SequenceManager)

Aggregations

OBJECTIVE_TYPE (eidolons.game.battlecraft.logic.meta.scenario.ObjectiveMaster.OBJECTIVE_TYPE)3 File (java.io.File)2 ChoiceSequence (eidolons.client.cc.gui.neo.choice.ChoiceSequence)1 EnumChoiceView (eidolons.client.cc.gui.neo.choice.EnumChoiceView)1 ListChoiceView (eidolons.client.cc.gui.neo.choice.ListChoiceView)1 SequenceManager (eidolons.client.dc.SequenceManager)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ObjType (main.entity.type.ObjType)1